pmndrs / jotai

👻 Primitive and flexible state management for React

Home Page:https://jotai.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RFC: Add `atomWithRefresh` in `jotai/utils`

dai-shi opened this issue · comments

atomWithRefresh has been a recipe, not a util.
We wanted to understand various use cases and thought the naive implementation was somewhat limited. My hesitation is also it can be overused, but that's probably a doc issue.

It's been a while and it seems the basic atomWithRefresh seems valuable. #849 (comment)

There might be several implementation ideas, like using a symbol like atomWithReset if that helps.

So, here's an RFC. Should we have atomWithRefresh in jotai/utils? 👍 / 👎

How could we incorporate debouncing or throttling into atomWithRefresh?

I think it's the out of the scope of atomWithRefresh or even Jotai library, which means it's a good opportunity for Jotai Labs and Jotai ecosystem.

#2393 supports write too.

Accepted and #2393 is ready.