Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Task] Improve performance of persisting redux states to local storage #725

Closed
tthvo opened this issue Dec 8, 2022 · 1 comment · Fixed by #753
Closed

[Task] Improve performance of persisting redux states to local storage #725

tthvo opened this issue Dec 8, 2022 · 1 comment · Fixed by #753
Assignees
Labels
chore Refactor, rename, cleanup, etc.

Comments

@tthvo
Copy link
Member

tthvo commented Dec 8, 2022

We are using store.subscribe to save redux states into local storage:

store.subscribe(() => saveToLocalStorage('TARGET_RECORDING_FILTERS', store.getState().recordingFilters.list));

This works but there are some issues:

  1. Entire store state is persisted regardless of which reducer is called.
  2. JSON.parse is a pretty expensive operation and should not be called too frequent.

We can explore this package as an alternative: https://www.npmjs.com/package/redux-persist

On this note, as our store grows (i.e. more actions, reducers, configs), we might also need a better organized directory structure under @app/Shared/Redux. Some useful readings: https://redux.js.org/faq/code-structure

@tthvo tthvo added the chore Refactor, rename, cleanup, etc. label Dec 8, 2022
@tthvo tthvo moved this to Todo in 2.3.0 release Dec 8, 2022
@tthvo tthvo self-assigned this Dec 8, 2022
@tthvo
Copy link
Member Author

tthvo commented Dec 13, 2022

We can explore this package as an alternative: https://www.npmjs.com/package/redux-persist

Development process seems to be stopped for a long time. Looking into alternatives.

Repository owner moved this from Todo to Done in 2.3.0 release Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Refactor, rename, cleanup, etc.
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant