redux-ignore | : recycle : higher-order reducer to ignore redux actions | State Container library
kandi X-RAY | redux-ignore Summary
kandi X-RAY | redux-ignore Summary
redux-ignore is a reducer enhancer (higher-order reducer), it provides the ignoreActions function, which takes an existing reducer and either:.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of redux-ignore
redux-ignore Key Features
redux-ignore Examples and Code Snippets
Community Discussions
Trending Discussions on redux-ignore
QUESTION
I have a redux application in flight that works very well. However, as a result of some db queries, one of the data structures stored in the state tree can contain 60,000+ entries. This can slow down the reaction time of the react ui considerably.
I do not have a large amount of reducers involved (maybe 20?) so I don't think redux-ignore could help. The data in the large data structure is read-only and does not need to be updated. However, with it loaded, using immutability-helper's update() or merge() on different sections of the tree can be slow.
Is this expected behavior? I am considering moving the data structure to localStorage, but storing it in the state tree keeps the code simple (as well as making broadside-loading the state easy).
Suggestions?
markerikson: No harm in sharing the reducer and the data structure! The only reducer responsible for the data structure part of the state is:
...ANSWER
Answered 2017-Mar-20 at 22:39You should consider using Immutable.js for your state. We've done apps with data structures as large as yours, and the UI is still very responsive after initial load. To my understanding, this is because the internals of the Immutable data structures pass around references to existing objects when it can. So when a single entry changes, it reuses 99% of the data instead of recreating the whole object from scratch. This allows state changes and component updates to be super quick.
Basically, if your state object isn't immutable, you're creating a brand-new state object every time your state changes, which includes rewriting your 60k+ entries.
UPDATE: Mark Erikson is correct below when he says that you can get around the rewrite issue by using "shallow clone" methods and making sure your reducers are compartmentalized in an effective way. However, I've also found that this is easy to accidentally mess up and can ruin your optimizations in places you don't expect. Immutable.js helps keep you away from these pitfalls, but also has its drawbacks. Check out this article from the Redux docs to help determine if it is in fact your best option. http://redux.js.org/docs/recipes/UsingImmutableJS.html
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install redux-ignore
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page