Closed n-mcnally closed 3 years ago
Hi @n-mcnally,
Can you please confirm if this is still an issue? The sandbox appears to be working as I'd expect.
Hi @mpeyper,
Thanks for having a look! I've just gave it another go and can confirm the problem is still occurring.
It typically works as expected the first time the reducer is attached/detached but then when it's re-attached i get the bug causing the undefined state in the selectors.
I have also confirmed in our own app that this only occurs when the Redux Devtool extention is enabled, if that's any use.
Closing. Please see #484 for details.
Is it a bug, feature request or question?
Bug
Which package(s) does this involve?
[@redux-dynostore/core, @redux-dynostore/react-redux]
Input Code
This implementation uses a simple
withReducer
HOC to attach and detach the provided reducers with the component.Code Sandbox
Expected Behaviour
When a component using
withReducer
is mounted the reducers should be attached then detached once unmounted.Current Behaviour
A small percentage of the time when re-attaching the reducer the state becomes
undefined
and causes the selectors to throw an error.After further investigation this issue only occurs whilst the Redux Devtools plugin is enabled.
Context
Parts of our app (data tables, grids) require large state trees and are rarely used more than once so would benefit from a reusable HOC for detaching the reducer once the component unmounts.
Your Setup