You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the "Dispatch" button is clicked, the first useSelector is called 5 times. All calls are expected except the third. The additional call would be fine except the captured variable now has reverted back to its original value for that call--the second time it was called, it had already been updated. Note: if you open the console, you'll see a message about "captured stale data" that identifies the bad call to useSelector. In react-redux 7.x, this additional call isn't made.
What version of React, ReactDOM/React Native, Redux, and React Redux are you using?
What is the current behavior?
I'm updating a project from react-redux 7.x to 8.x, and I think I'm running into a bug. I'm seeing a call to
useSelector
with stale captured values. Here's a simplified project that demonstrates the issue: https://codesandbox.io/s/react-redux-8-closure-w8zqf4?file=/src/App.jsWhen the "Dispatch" button is clicked, the first
useSelector
is called 5 times. All calls are expected except the third. The additional call would be fine except the captured variablenow
has reverted back to its original value for that call--the second time it was called, it had already been updated. Note: if you open the console, you'll see a message about "captured stale data" that identifies the bad call to useSelector. In react-redux 7.x, this additional call isn't made.What is the expected behavior?
Here's the exact same code with version 7.2.9 of react-redux: https://codesandbox.io/s/react-redux-7-closure-4lq8ph?file=/src/App.js
Which browser and OS are affected by this issue?
No response
Did this work in previous versions of React Redux?
The text was updated successfully, but these errors were encountered: