facebookexperimental/Recoil

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

開放

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

 (6 則留言) (1 個反應) (0 位負責人)JavaScript (1,151 個分叉)batch import
enhancementhelp wanted

倉庫指標

星標
 (19,428 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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

貢獻者指南