Replies: 1 comment
-
"Refreshing" a selector basically clears the selector cache and causes it to be re-evaluated if used. It can be useful if a selector issues a query and you want it to re-query. But, it's kind of a big hammer since it also clears the cache for all ancestor selectors. It's also currently a no-op for atoms, but that is subject to change. It will not, however, reset an atom state. A selector can also be "reset" and will get a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've just started looking at Recoil and so far it seems great. However, one thing that I'm struggling with is refreshing of atoms that are themselves behind selectors.
Specifically, I'm wrapping a Hypermedia API. So far I've got:
selector
for the Home document - which will contain a link to the current useratomFamily
for getting Users, provided a link to the given userselector
for getting the Current User - which first gets thehome-document
selector, gets the correct link from that and then gets theuser-document
atom for that link.This all works fine. However, when building a User Profile screen I want to render and force refresh the Current User details.
This means that I'd want to refresh the
current-user
selector, which in turn causes it to refresh theuser-document
atom for the given user link.As I understand it, I can manually refresh the
current-user
selector, or I can manually refresh theuser-document
atom, but I'm not sure if I can make it so that refreshing thecurrent-user
selector will automatically refresh the appropriateuser-document
atom?Is such a thing possible? Or is there some way that I can achieve this?
Cheers
Beta Was this translation helpful? Give feedback.
All reactions