Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rehydratation changes all store references on UPDATE_ACTION

See original GitHub issue

When rehydrating store in lazy load feature, changes the references of all store object and this mean that all the subscriptions are fired without changes in the store. This subscriptions are fired several times if you have a preload strategy (such as feature modules are loaded).

I’ve created a minimal project to show this behaviour:

I’ve created the project with preloadingStragegy on PreloadAllModules to show that fires 2 times with 2 lazy loading feature modules, but it happens without this strategy when you load the featured module (change the route).

Steps to reproduce: 1.- Go to 2.- Open the console 3.- Click on “Load global data”. This fills the global state and save it on localStorage. 4.- Reload the page.

You can see on console that “receiving global data” is printed 3 times:

  • First one by the initial rehydration from appModule
  • Second and third by every lazy loaded feature (feature1 and feature2)

I think this is a serious bug, we have a production application with lots of lazy loaded modules and in some places the subscriptions are fired 10 times! If you dispatch actions that makes http request this is crazy

I’ve found that if we change the line

            nextState = merge({}, nextState, rehydratedState);


            nextState = merge(nextState, rehydratedState);

solves the problem, but I’m not sure if this can cause other issues.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

rafa-ascommented, Jun 7, 2019

please @btroncone can you check this?

Jonnyprofcommented, Apr 17, 2020

Yes, I know the historial lodash - deepmerge path, because of it I’ve used deepmerge in my solution. We have a large application with lazy load modules depending on the page and connection, and if every time that we load an async module all the async pipes to the store are emitted, the loose of performance is huge due to changeDetection is fired for all the components.

Read more comments on GitHub >

github_iconTop Results From Across the Web

rehydratedState is not recalculated on UPDATE_ACTION #120
Rehydratation changes all store references on UPDATE_ACTION #128. Open. @Jonnyprof Jonnyprof mentioned this issue on Apr 18, 2020.
Read more >
redux-persist - UNPKG
/_Symbol.js';\n\n/** Used for built-in method references. ... n * The only way to change the data in the store is to call `dispatch()`...
Read more >
KDIGO 2012 Clinical Practice Guideline for the Evaluation and ...
CKD progression and risk of all-cause mortality and ESRD using baseline (first) eGFR. 68. Table 24. Association between absolute and percentage change in ......
Read more >
B2B Integration : A Practical Guide to Collaborative E-commerce
relevant to the subject of B2B integration. References/Bibliography. The book acknowledges various sources used by giving references and a bibliography.
Read more >
BizTalk Server Exam Preparation Diary | BizTalk360 Blogs
Reference : BizTalk Server 2006 Runtime Improvements Reference: BizTalk ... Monitors the rules store to detect changes to published policies, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found