ThirtyTech / yasml

Yet another react state management library. Easy to work with and feels like regular hooks.
https://yasml.vercel.app
MIT License
0 stars 0 forks source link

With new _cacheContext we need to determine if there is a data conflict multiple providers #3

Open jsheely opened 6 days ago

jsheely commented 6 days ago

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

<MyProvider value="1">

Does it always get one or would the tree under provider two sometimes get another number

jsheely commented 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.