facebookexperimental/Recoil

Feature Request: option to refresh to not recursively refresh all upstream selectors

Open

#1677 opened on Mar 17, 2022

View on GitHub
 (6 comments) (1 reaction) (0 assignees)JavaScript (19,428 stars) (1,151 forks)batch import
enhancementhelp wanted

Description

from the docs https://recoiljs.org/docs/api-reference/core/useRecoilRefresher

It is currently a no-op to "refresh" an atom, it will retain its current state. Selectors will have their caches cleared. Because wrapper selectors are often used as abstractions, refreshing a selector will also recursively refresh the caches of all selectors that it depends on.

However, if those upstream selectors have not changed but is used from the refreshed selector it will once again refresh and refetch (if doing some data fetching). IMO a good solution is an option that we can pass in to refresh to not refresh upstream selectors especially since its also a common use case. the current behavior would cause a cascade of refreshes when a lot of them are unnecessary

Contributor guide