[WIP] Refactor to use the new jotai store derive method (Attempt 2)#56
Closed
[WIP] Refactor to use the new jotai store derive method (Attempt 2)#56
Conversation
d976bb2 to
216e00e
Compare
a98a7a8 to
fd3a124
Compare
9900cd5 to
844f875
Compare
5e7c53b to
19e5a4e
Compare
857e730 to
32a4ddf
Compare
32a4ddf to
9e212c0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
Update ScopeProvider to use the new exposed internals api (pmndrs/jotai#2911).
The new code is much simpler and should address #25 and #36.
Changes
Resolves #25 and #36.
storeprop added to ScopeProvider props.The scoped store will use the internals of this store if provided.
TODO
Tests Results
01_basic_spec✅ 01. ScopeProvider does not provide isolation for unscoped primitive atoms
✅ 02. unscoped derived atoms are unaffected in ScopeProvider
✅ 03. ScopeProvider provides isolation for scoped primitive atoms
❌ 04. unscoped derived can read and write to scoped primitive atoms
❌ 05. unscoped derived can read both scoped and unscoped atoms
❌ 06. dependencies of scoped derived are implicitly scoped
❌ 07. scoped derived atoms can share implicitly scoped dependencies
✅ 08. nested scopes provide isolation for primitive atoms at every level
❌ 09. unscoped derived atoms in nested scoped can read and write to scoped primitive atoms at every level
❌ 10. inherited scoped derived atoms can read and write to scoped primitive atoms at every nested level
02_removeScope✅ atom get correct value when ScopeProvider is added/removed
03_nested✅ nested primitive atoms are correctly scoped
04_derived❌ parent scope's derived atom is prior to nested scope's scoped base
05_derived_self❌ derived dep scope is preserved in self reference
06_implicit_parent✅ level 1: "BD" and level 2: "BD"
✅ level 1: "BD" and level 2: "DB"
✅ level 1: "DB" and level 2: "BD"
✅ level 1: "DB" and level 2: "DB"
07_writable✅ "writableAtom" updates its value in both scoped and unscoped and read scoped atom (27 ms)
✅ "thisWritableAtom" updates its value in both scoped and unscoped and read scoped atom (5 ms)