Registry / storage / redux-storage-decorator-filter

redux-storage-decorator-filter

JSON →
library1.1.8jsnpmunverified

Filter decorator for redux-storage that allows whitelisting or blacklisting state keys to control which parts of the Redux store are persisted. Version 1.1.8 is the latest stable release. This is a maintained fork of the original abandoned package by michaelcontento. Key differentiator: simple array-based configuration for nested keys without boilerplate.

npm install redux-storage-decorator-filter
INSTALL
IMPORT
SIG · REDUX-STORAGE-DECO
R
redux-storage-decorator-filter
storagejavascriptv1.1.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

filter
import filter from 'redux-storage-decorator-filter'
import { filter } from 'redux-storage-decorator-filter'
Default export only; named import will not work.
filter (default import via require)
const filter = require('redux-storage-decorator-filter').default
const filter = require('redux-storage-decorator-filter')
CommonJS require returns an object with a default property since the package uses ES modules.
FilterDecorator (type import for TypeScript)
import FilterDecorator from 'redux-storage-decorator-filter'; type Engine = any; // no TS types provided
import { FilterDecorator } from 'redux-storage-decorator-filter'
Package has no TypeScript declarations; use any type.

Shows how to create a filtered redux-storage engine that persists only whitelisted state keys.

import filter from 'redux-storage-decorator-filter'; import createEngine from 'redux-storage-engine-localstorage'; // Create a base engine const baseEngine = createEngine('my-app'); // Only persist 'auth' and 'settings.theme' (nested) const filteredEngine = filter(baseEngine, [ 'auth', ['settings', 'theme'] ], []); // Use filteredEngine with redux-storage middleware import { createStore, applyMiddleware } from 'redux'; import * as storage from 'redux-storage'; const reducer = storage.reducer(combineReducers({ /* ... */ })); const middleware = storage.createMiddleware(filteredEngine); const store = createStore(reducer, applyMiddleware(middleware)); // Load persisted state storage.createLoader(filteredEngine)(store);
Debug
Known issues
gotchaPackage uses ES modules; CommonJS require must use .default.
fix
Use import or require('...').default.
affects: >=1.0
gotchaDoes not provide TypeScript type definitions.
fix
Add a custom declaration file or use @ts-ignore.
affects: >=1.0
breakingThe original package (michaelcontento/redux-storage-decorator-filter) is abandoned. This fork (react-stack) may have different API or bugs.
fix
Upgrade to react-stack version 1.x and check for behavior differences.
affects: <1.0 (original)
gotchaFilter engine mutates the wrapped engine; ensure engine is not shared.
fix
Pass a new engine instance to filter().
affects: >=1.0
Errors
Common errors & fixes
Cannot find module 'redux-storage-decorator-filter'
Package not installed or import path incorrect.
fix
npm install redux-storage-decorator-filter --save
TypeError: filter is not a function
Importing as named export instead of default.
fix
Use import filter from 'redux-storage-decorator-filter'
Error: Invalid engine provided to filter
Engine argument is null or not a valid redux-storage engine.
fix
Call filter with a valid engine instance first: const engine = createEngine('key'); filter(engine, ...)
Upgrade
Version history
1.1.8latest on npm
Audit
Dependencies
redux-storagerequiredThis is a decorator for redux-storage engine; it wraps an engine instance.
Agent activity
19 hits · last 30 days
node
18
Resources
redux-storage-decorator-filter — npm install redux-storage-decorator-filter · libregistry