atomWithDefault: setting RESET twice only calls getDefault once #2737
-
First off, I'm not sure if this is a bug or an intended part of the atom, so I was hesitant to mark it as a bug. If you have an
Here's a codesandbox to show off a possible implementation. The first set of buttons are for I'm happy to have the custom version in my codebase, but thought I'd post this here in case this really is a bug, or if changing the behavior is better. Or, if this is something that should be documented in the docs for |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
RESET isn't "re-fetch" or "re-evaluate", and I think the current behavior and the implementation is by design. It should be refresh counter, like atomWithRefresh. (Otherwise, setting RESET twice in sync will be NO-OP.) I think the discussion #1914 is somewhat related, but not similar. |
Beta Was this translation helpful? Give feedback.
This is by design.