Skip to content

Lifts redux store subscriptions to context#137

Closed
ctrlplusb wants to merge 1 commit intomasterfrom
zombie-children
Closed

Lifts redux store subscriptions to context#137
ctrlplusb wants to merge 1 commit intomasterfrom
zombie-children

Conversation

@ctrlplusb
Copy link
Copy Markdown
Owner

Closes #136

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 25, 2019

Codecov Report

Merging #137 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #137   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           9      9           
  Lines         295    313   +18     
  Branches       46     47    +1     
=====================================
+ Hits          295    313   +18
Impacted Files Coverage Δ
src/provider.js 100% <100%> (ø) ⬆️
src/hooks.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 67f656b...b4c7e3b. Read the comment docs.

@MrWolfZ
Copy link
Copy Markdown

MrWolfZ commented Mar 25, 2019

Regarding your comment here:

Hi all, joining this discussion as @MrWolfZ informed me that my library would suffer the same "zombie child" issue as discussed here.

I've managed to get around this by lifting the redux store subscriptions for the hooks to the root context, which allows me to execute the mapStates in an order that is more likely to represent the component hierarchy.

PR is here: #137

Demo: https://codesandbox.io/s/pm39mzn13m

I still need to do a lot more tinkering. But wanted to put this on your radar. Hoping to get some early feedback on whether this is a crazy idea or not. 👍

Lifting the subscriptions to the root context does nothing to the order in which mapStates are executed. Also, you are using Object.values which is even worse, since it has an undefined ordering. Also, as mentioned in #136 this code throws hidden errors.

@ctrlplusb
Copy link
Copy Markdown
Owner Author

Appreciate the review ❤️

@ctrlplusb ctrlplusb closed this Mar 25, 2019
@ctrlplusb
Copy link
Copy Markdown
Owner Author

Closing as better understand the problem now and have an alternative solution brewing...

@ctrlplusb ctrlplusb deleted the zombie-children branch March 25, 2019 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants