This repository has been archived by the owner on Jan 27, 2021. It is now read-only.
Fixed issue when root subspace was composed with redux dev tools #47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is a pretty severe bug with the current alpha version when composing
applyMiddleware
with the redux-devtools-extension that causes an infinite loop whengetState
was called.I'm not sure why it only occured when using the extension, and not when using the dev tools directly, like in the real world example, but this change works for both, and when not using dev tools at all.
The change looks more complicated than it really is. Basically, if the subspace is the root store, don't map the state, or namespace the actions (it was defaulting to
subspace((state) => state, undefined)
anyway).To achieve this I also had to fix a minor issue when subspaces not created from
applyMiddleware
thought they were the root store ifapplyMiddleware
was not used at all. Most of the noise in this review is caused by fixing that, rather than the actual bug.