redux-persist#persistReducer TypeScript Examples

The following examples show how to use redux-persist#persistReducer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: store.ts    From UsTaxes with GNU Affero General Public License v3.0 7 votes vote down vote up
persistedReducer = fsReducer(
  'ustaxes_save.json',
  persistReducer<CombinedState<YearsTaxesState>, Actions>(
    {
      key: 'root',
      // Changing the version here will set the version used
      // in the app. When the data is rehydrated the version
      // number will be compared and all migrations between
      // the persisted version and the version here will be
      // applied in order
      version: 1,
      storage,
      migrate: createMigrate(migrations, { debug: false }),
      transforms: [dateStringTransform]
    },
    rootReducer
  )
)
Example #2
Source File: storage.tsx    From reactant with MIT License 7 votes vote down vote up
beforeCombineRootReducers(reducers: ReducersMapObject): ReducersMapObject {
    for (const [_, set] of this.storageSettingMap) {
      set();
    }
    Object.keys(reducers).forEach((key) => {
      const isTempIdentifier = /^@@reactant\//.test(key);
      if (isTempIdentifier) {
        this.blacklist.push(key);
      }
      const persistConfig = this.persistConfig[key];
      if (persistConfig) {
        const reducer = persistReducer(persistConfig, reducers[key]);
        Object.assign(reducers, {
          [key]: reducer,
        });
      } else if (this.persistRootConfig.blacklist) {
        // use blacklist mode
        if (isTempIdentifier) {
          if (__DEV__) {
            console.warn(
              `For state persistence, The '@injectable({ name })' in the ${key} module has not been set yet.`
            );
          }
        }
      }
    });
    return reducers;
  }
Example #3
Source File: index.tsx    From majsoul-api with MIT License 6 votes vote down vote up
store = createStore(
	persistReducer(
		{
			key: "root",
			storage,
			whitelist: ["user"]
		},
		contestReducer
	),
	{
		contestsById: {},
		musicPlayer: {
			playing: false,
			videoId: null
		},
	} as IState as any,
	composeEnhancers(),
)
Example #4
Source File: store.ts    From THUInfo with MIT License 6 votes vote down vote up
rootReducer = combineReducers({
	auth: persistReducer(
		{
			keyPrefix: "com.unidy2002.thuinfo.persist.auth.",
			storage: KeychainStorage,
			key: "auth",
		},
		auth,
	),
	schedule,
	config,
	credentials: persistReducer(
		{
			keyPrefix: "com.unidy2002.thuinfo.persist.credentials.",
			storage: KeychainStorage,
			key: "credentials",
		},
		credentials,
	),
	top5,
	reservation,
})
Example #5
Source File: storage.tsx    From reactant with MIT License 6 votes vote down vote up
afterCombineRootReducers(rootReducer: Reducer) {
    return persistReducer(
      {
        blacklist: [...Object.keys(this.persistConfig), ...this.blacklist],
        ...this.persistRootConfig,
      },
      rootReducer
    );
  }
Example #6
Source File: index.ts    From jellyfin-audio-player with MIT License 6 votes vote down vote up
persistedReducer = persistReducer(persistConfig, reducers)
Example #7
Source File: store.ts    From slice-machine with Apache License 2.0 6 votes vote down vote up
export default function configureStore(
  preloadedState: Partial<SliceMachineStoreType> = {}
): { store: Store<SliceMachineStoreType>; persistor: Persistor } {
  const middlewares = [sagaMiddleware, routerMiddleware];
  const enhancers = [applyMiddleware(...middlewares)];

  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
  const composeEnhancers =
    process.env.NODE_ENV !== "production" &&
    typeof window === "object" &&
    window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
      ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
      : compose;

  const rootReducer = createReducer();

  const persistedReducer = persistReducer(persistConfig, rootReducer);
  const store: Store<SliceMachineStoreType> = createStore(
    persistedReducer,
    preloadedState,
    // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
    composeEnhancers(...enhancers)
  );
  const persistor = persistStore(store);
  sagaMiddleware.run(rootSaga);

  return { store, persistor };
}
Example #8
Source File: store.ts    From openchakra with MIT License 6 votes vote down vote up
storeConfig = {
  models,
  redux: {
    // @ts-ignore
    combineReducers: reducers => {
      return combineReducers({
        ...reducers,
        components: persistReducer(
          persistConfig,
          undoable(reducers.components, {
            limit: 10,
            filter: filterUndoableActions,
          }),
        ),
      })
    },
  },
  plugins: [persistPlugin],
}
Example #9
Source File: index.ts    From interbtc-ui with Apache License 2.0 5 votes vote down vote up
rootReducer = combineReducers({
  general: persistReducer(generalPersistConfig, generalReducer),
  redeem,
  issue,
  vault
})
Example #10
Source File: index.ts    From hive-keychain-mobile with MIT License 5 votes vote down vote up
persistedReducers2 = persistReducer(persistConfig2, reducers)
Example #11
Source File: store.ts    From dh-web with GNU General Public License v3.0 5 votes vote down vote up
persistedReducer = persistReducer({
    key: "root",
    storage,
    whitelist: ["authResourceReducer"]
}, combineReducers({ authResourceReducer }))
Example #12
Source File: store.ts    From neodash with Apache License 2.0 5 votes vote down vote up
persistedReducer = persistReducer(persistConfig, rootReducer)
Example #13
Source File: store.ts    From shadowsocks-electron with GNU General Public License v3.0 5 votes vote down vote up
persistedReducer = persistReducer(persistConfig, rootReducer)
Example #14
Source File: store.ts    From OpenBA-NextGenTV with MIT License 5 votes vote down vote up
persistedReducer = persistReducer(persistConfig, rootReducer)
Example #15
Source File: index.ts    From Covid19 with MIT License 5 votes vote down vote up
persistedReducer = persistReducer(persistConfig, rootReducer)
Example #16
Source File: store.ts    From prompts-ai with MIT License 5 votes vote down vote up
persistedReducer = persistReducer(persistConfig, reducers)
Example #17
Source File: root-reducer.ts    From beancount-mobile with MIT License 5 votes vote down vote up
persistedReducer = persistReducer(persistConfig, reducer)
Example #18
Source File: store.ts    From pali-wallet with MIT License 5 votes vote down vote up
persistedReducer = persistReducer(persistConfig, reducers)
Example #19
Source File: index.tsx    From Pi-Tool with GNU General Public License v3.0 5 votes vote down vote up
persistedReducer = persistReducer(persistConfig, rootReducer)
Example #20
Source File: index.ts    From hive-keychain-mobile with MIT License 5 votes vote down vote up
persistedReducers = persistReducer(persistConfig, reducers)
Example #21
Source File: store.ts    From nyxo-app with GNU General Public License v3.0 5 votes vote down vote up
persistedReducer = persistReducer(persistConfig, rootReducer)
Example #22
Source File: store.ts    From extension with MIT License 5 votes vote down vote up
createPersistReducer = (config: any) =>
  persistReducer(config, rootReducer)
Example #23
Source File: walletSlice.ts    From celo-web-wallet with MIT License 5 votes vote down vote up
persistedWalletReducer = persistReducer<ReturnType<typeof walletReducer>>(
  persistConfig,
  walletReducer
)
Example #24
Source File: validatorsSlice.ts    From celo-web-wallet with MIT License 5 votes vote down vote up
persistedValidatorsReducer = persistReducer<ReturnType<typeof validatorsReducer>>(
  persistConfig,
  validatorsReducer
)
Example #25
Source File: tokensSlice.ts    From celo-web-wallet with MIT License 5 votes vote down vote up
persistedTokensReducer = persistReducer<ReturnType<typeof tokenReducer>>(
  persistConfig,
  tokenReducer
)
Example #26
Source File: tokenPriceSlice.ts    From celo-web-wallet with MIT License 5 votes vote down vote up
persistedTokenPriceReducer = persistReducer<ReturnType<typeof tokenPriceReducer>>(
  persistConfig,
  tokenPriceReducer
)
Example #27
Source File: settingsSlice.ts    From celo-web-wallet with MIT License 5 votes vote down vote up
persistedSettingsReducer = persistReducer<ReturnType<typeof settingsReducer>>(
  persistConfig,
  settingsReducer
)
Example #28
Source File: nftSlice.ts    From celo-web-wallet with MIT License 5 votes vote down vote up
persistedNftReducer = persistReducer<ReturnType<typeof nftReducer>>(
  persistConfig,
  nftReducer
)
Example #29
Source File: contactsSlice.tsx    From celo-web-wallet with MIT License 5 votes vote down vote up
persistedContactsReducer = persistReducer<ReturnType<typeof contactsReducer>>(
  persistConfig,
  contactsReducer
)