Polymer / pwa-starter-kit

Starter templates for building full-featured Progressive Web Apps from web components.
https://pwa-starter-kit.polymer-project.org
2.36k stars 431 forks source link

Persistent storage with lazy loading reducers #380

Closed zeratax closed 4 years ago

zeratax commented 5 years ago

I wanted to use the starter kit with persistent localstorage as seen here: https://github.com/notwaldorf/flash-cards/blob/master/src/localStorage.js

Which works great as long as I have the redux devTools installed, but without whenever I lazy load a reducer, like e.g. here: https://github.com/Polymer/pwa-starter-kit/blob/master/src/components/my-view2.js#L21 https://github.com/Polymer/pwa-helpers/blob/master/src/lazy-reducer-enhancer.ts#L39

That part of the state gets reset to the initial state configuration. This seems to happen after the @@redux/REPLACE action is fired.

Adding these reducers to store.js fixes this, but obviously renders the lazy loading useless

How would I go about having lazy loaded reducers check if state is already there?

stale[bot] commented 4 years ago

This project is no longer under development and will be transitioning to a read-only repo. Thank you for your contributions.