Recoil
Recoil copied to clipboard
Effects getLoaded method is returning stale atom state
Versions React: 18.2.0 Recoil: 0.7.5 Node: v16.14.2
The getLoadable
method passed to an Atom Effect returns stale state. We recently upgraded to Recoil version 0.7.5 from version 0.5.2 and it no longer works as expected. I have created a simple app with a test case that illustrates the bug.
The app has two components. A parent component thats responsible for setting a sport and a child component that shows a list of teams in that sport. The selected sport is held in one atom and the list of filtered teams is held in another. The list of filtered teams is loaded using an effect. That effect determines what sport has been selected by using the getLoadable
method passed to it. In the test case, even though the selected sport state has clearly been set, the getLoadable
method is returning undefined.
I missed this issue yesterday when I was looking through the issues. Could they be related?