Open jsheely opened 6 days ago
Ran a few quick tests but wasn't able to replicate the bug. This would likely only happen on large projects as the cache will only get used when Provider fn doesn't run fast enough for the useSelector call.
This would only be a slight issue in dev since the hot reloading is causing the entire state to update again anyway. It might just be off for a transient hot reloading render cycle and work itself out before you can interact with the page anyway.
My hunch is that because we are using
State.name
as the map key that is too limited to when the provider is used multiple times. It is possible that for a render cycle it will pick up the wrong provider context cache value.Should be able to test this by just adding multiple providers with different passed in props to the state and see what happens during hot reloading
ex
Does it always get one or would the tree under provider two sometimes get another number