redux-persist#persistStore TypeScript Examples

The following examples show how to use redux-persist#persistStore. 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: storage.tsx    From reactant with MIT License 6 votes vote down vote up
afterCreateStore(store: Store) {
    const { replaceReducer } = store;
    // eslint-disable-next-line no-param-reassign
    store.replaceReducer = (reducer: Reducer) => {
      replaceReducer(reducer);
      this.persistor = persistStore(store, null, () => {
        // TODO: check
        this.rehydrated = true;
        this.onRehydrate?.();
      });
    };
    this.persistor = persistStore(store, null, () => {
      this.rehydrated = true;
      this.onRehydrate?.();
    });
  }
Example #2
Source File: store.ts    From extension with MIT License 6 votes vote down vote up
export function configureStore() {
  const store = createStore(
    createPersistReducer(extensionConfig),
    appInitialState,
    enhancer
  )
  const persistor = persistStore(store)
  return { store, persistor }
}
Example #3
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 #4
Source File: store.ts    From shadowsocks-electron with GNU General Public License v3.0 5 votes vote down vote up
persistor = persistStore(store as any)
Example #5
Source File: index.tsx    From majsoul-api with MIT License 5 votes vote down vote up
persistor = persistStore(store)
Example #6
Source File: store.ts    From UsTaxes with GNU Affero General Public License v3.0 5 votes vote down vote up
persistor = persistStore(store)
Example #7
Source File: store.ts    From pali-wallet with MIT License 5 votes vote down vote up
persistStore(store);
Example #8
Source File: store.ts    From beancount-mobile with MIT License 5 votes vote down vote up
persistor = persistStore(store)
Example #9
Source File: index.tsx    From resume-builder with MIT License 5 votes vote down vote up
constructor(props: any) {
        super(props);
        this.persistor = persistStore(props.reduxStore);
    }
Example #10
Source File: store.ts    From prompts-ai with MIT License 5 votes vote down vote up
persistor = persistStore(store)
Example #11
Source File: index.ts    From Covid19 with MIT License 5 votes vote down vote up
persister = persistStore(store)
Example #12
Source File: store.ts    From openchakra with MIT License 5 votes vote down vote up
persistPlugin = {
  onStoreCreated(store: any) {
    if (process.browser) {
      persistStore(store)
    }
  },
}
Example #13
Source File: store.ts    From OpenBA-NextGenTV with MIT License 5 votes vote down vote up
persistor = persistStore(store)
Example #14
Source File: index.tsx    From Pi-Tool with GNU General Public License v3.0 5 votes vote down vote up
persistor = persistStore(store)
Example #15
Source File: index.tsx    From neodash with Apache License 2.0 5 votes vote down vote up
persister = persistStore(store)
Example #16
Source File: store.ts    From dh-web with GNU General Public License v3.0 5 votes vote down vote up
persistor = persistStore(store)
Example #17
Source File: index.ts    From jellyfin-audio-player with MIT License 5 votes vote down vote up
persistedStore = persistStore(store)
Example #18
Source File: store.ts    From interbtc-ui with Apache License 2.0 5 votes vote down vote up
persistor = persistStore(store)
Example #19
Source File: index.ts    From hive-keychain-mobile with MIT License 5 votes vote down vote up
persistor = persistStore(store)
Example #20
Source File: store.ts    From nyxo-app with GNU General Public License v3.0 5 votes vote down vote up
persistor = persistStore(store)
Example #21
Source File: store.ts    From celo-web-wallet with MIT License 5 votes vote down vote up
persistor = persistStore(store)
Example #22
Source File: WalletStateStore.ts    From BitcoinWalletMobile with MIT License 5 votes vote down vote up
persistor = persistStore(store)
Example #23
Source File: store.ts    From THUInfo with MIT License 5 votes vote down vote up
persistor = persistStore(store)