facebookexperimental/Recoil

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

Open

#1,677 建立於 2022年3月17日

在 GitHub 查看
 (6 留言) (1 反應) (0 負責人)JavaScript (19,428 star) (1,151 fork)batch import
enhancementhelp wanted

描述

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

貢獻者指南

Feature Request: option to refresh to not recursively refresh all upstream selectors · facebookexperimental/Recoil#1677 | Good First Issue