We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When a value in the derived store is used within a function after the original store value has been changed, there is a race condition.
Here is a simplified version my code.
const hasSoldoutItems = useDerivedBagStore((state) => state.hasSoldoutItems); const removeSoldoutItems = useBagStore((state) => state.removeSoldoutItems); const { handleCheckoutOpen } = useLayoutContext(); const goToCheckout = async () => { if (hasSoldoutItems) { removeSoldoutItems(); } if (hasSoldoutItems) return; if (numberOfBagItems === 0) return; handleCheckoutOpen(); };
The text was updated successfully, but these errors were encountered:
Sounds like nice catch. Could you create a minimal reproduction with https://codesandbox.io/s/react-new ?
Sorry, something went wrong.
No branches or pull requests
When a value in the derived store is used within a function after the original store value has been changed, there is a race condition.
Here is a simplified version my code.
The text was updated successfully, but these errors were encountered: