jotaijs / jotai-scope

MIT License
55 stars 4 forks source link

Instance level debug flag for jotai-scope? #19

Closed yf-yang closed 4 months ago

yf-yang commented 7 months ago

Observability becomes an issue for jotai-scope, because with scoped atom, each atom will have multiple "instances" and JavaScript does not expose id() alike mechanism for distinguish instances of the same object.

Can we design an "instance level" debug flag for each scoped atom? That would help debugging.

dai-shi commented 7 months ago

Hi, thanks for opening an issue. Though, I'm not sure if I precisely understand the suggestion. Is it only about jotai-scope? Do "instances" mean the wrapped atoms?

yf-yang commented 7 months ago

Hmmm, when I start the issue, I mean the "scopedAtom" created in the ScopeProvider because it has the same debug label with the original one, so I cannot easily distinguish them. The temp property in this comment https://github.com/jotaijs/jotai-scope/issues/17#issuecomment-1897667703 is an example.

If I got it right, "wrapped atoms" means create an internal atom, then expose its derived atom to the global scope? It is already handled by debug label, right?

dai-shi commented 7 months ago

sorry i meant "scoped atoms".

I think I understand what you mean by instance-level debug flag.