facebookexperimental/Recoil

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

オープン

#1,677 opened on 2022/03/17

 (6 件のコメント) (1 件のリアクション) (0 人の担当者)JavaScript (1,151 件のフォーク)batch import
enhancementhelp wanted

Repository metrics

Stars
 (19,428 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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

コントリビューターガイド