Closed dai-shi closed 10 months ago
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Latest deployment of this branch, based on commit 42a3b0219979c2bb3c5cb4fa45e0798396dbacf7:
Sandbox | Source |
---|---|
React | Configuration |
React TypeScript | Configuration |
Much neater, the drawback is, in the second scenario mentioned https://github.com/jotaijs/jotai-scope/issues/8#issuecomment-1776665511, those non-scoped atoms have to call getScopedAtom
and search all the parent stores until they reach the top level. Not sure if that behavior can be optimized.
Yes, that hasn't been changed since the previous one.
(Oh, reviewing the code again, I found that the scope context value [1] is not enough for nested scope providers. will work on it some time later. It's not for the actual use anyway.)
@yf-yang gave a nice insight. Patching is hard. This patches store instead of hooks. This is like the combination of the first impl #2 and the second impl #5. Having Provider in the ScopeProvider tree may result in a weird behavior, but it's probably rare, or it's not recommended.
close #8