How to use the ngrx-store-localstorage.rehydrateApplicationState function in ngrx-store-localstorage

To help you get started, we’ve selected a few ngrx-store-localstorage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github intershop / intershop-pwa / src / app / core / utils / local-storage-sync / local-storage-sync.reducer.ts View on Github external
return (state: {}, action: any) => {
    if (action.type === STORAGE && keys.includes(action.payload)) {
      if (bindAllTabs && localStorage) {
        const rehydratedState = rehydrateApplicationState([action.payload], localStorage, k => k, true);
        return { ...state, ...rehydratedState };
      }
      return state;
    }
    return localStorageSync({
      keys,
      rehydrate: true,
      restoreDates: true,
    })(reducer)(state, action);
  };
}

ngrx-store-localstorage

State and local storage syncing for @ngrx/store

MIT
Latest version published 5 months ago

Package Health Score

76 / 100
Full package analysis