-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Persist Nested Subscriptions Through Hot Reload #715
Conversation
Sweet, thanks! We'll definitely want @jimbolla to take a look at this, and I'll try to find time to look over it myself as well. |
At first glance it makes sense, but I'll have to think awhile about any foreseeable issues. |
At any rate, any issues would only affect hot-reloading, which is currently broken, so this is almost certainly an improvement. |
Is something blocking this? Is there anything we can do to help? |
it would make a life much easier for many devs, please pull |
I think this is OK to merge. |
Cool. Here we go... |
Thanks guys! |
Any idea when this will be published? |
Hi! This PR should fix an issue #636 which makes our work very unconfortable due to hot reload issues. Personally I tried to downgrade to latest I think I will speak for many developers waiting if I'll kindly ask you to please release this fix as soon as possible. Thaтks a lot! |
OK, pushed out 5.0.6. |
I ran into this just the other day, so awesome to get it fixed! Thanks everyone! |
This seem to fix #636 |
This resolves #670.
This likely also resolves #636 but I encounter errors installing the linked repo on my machine.
Cause Of Issue
When a connected component hot reloads, it unsubscribes and then resubscribes to store updates. As part of unsubscription, all child listeners (also referred to as
nestedSubs
) are removed. For child components that also hot-reload, this is fine, as they will resubscribe during the hot reload. However, if any of the hot reloading parent's descendants are connected but do not hot reload, they are never resubscribed to store updates.Solution
To resolve this, we persist the previous component's listeners to the reloaded version of the component, so that descendants that did not reload are still subscribed properly to store updates.
Downsides
This does mean that the old versions of hot reloaded components are still subscribed, but when they unmount as part of the reload, their
selector.shouldComponentUpdate
,selector.run
, andnotifyNestedSubs
are all set to no-ops, making theironStateChange
always a no-op itself.