-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
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
Rerun Atom Effects when Atom is reset or refreshed #1685
Comments
I don't know that re-running them with a reset would be appropriate. It's debatable, but it would be a breaking change. Another option been considering is re-running them with the "refresh" API. The potential concern there would be potentially implicitly doing that for upstream atoms since refreshing a selector defaults to transitively refreshing upstream selectors. For now, you can manually achieve this with the onSet() atom effect callback checking the isReset flag |
Thanks. I was able to use the suggested and change the atom value on reset but I see an error |
@SunilChiluvuri - That's an invalid error message which can be ignored. It was fixed with #1589 / #1582 . Looks like that hasn't been included in the latest open-source release, but should be included with the upcoming 0.7 release. |
when using Atom Effects, if the atom is reset using useResetRecoilState, the atom value is set to default but effects are not rerun.
Is there a way to "reinitialize" the atom which causes the Atom Effects to be rerun?. If not, is one in the works?
Thanks for Recoil its great to have minimal boilderplate
The text was updated successfully, but these errors were encountered: