-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
David Maskasky
committed
Sep 24, 2024
1 parent
914d987
commit 5bc54a3
Showing
12 changed files
with
721 additions
and
333 deletions.
There are no files selected for viewing
This file contains 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
269 changes: 259 additions & 10 deletions
269
__tests__/derive/understanding/unstable_derive.test.ts
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
computed atoms are like implicit atoms but reverse | ||
computed atoms are not copied | ||
reverseImplicitSet is a set of computed atoms to indicate whether a computed atom should be treated as a reverse implicit | ||
the atom is removed from the set between recomputations | ||
by intercepting the readFn, if an atom is `get` that is either an explicit or reverse implicit, | ||
|
||
- then the atom is added to the reverse implicit set | ||
|
||
only the readFn determines if the atom is added to the reverse implicit set | ||
intercepting the readFn and writeFn is used to get the "correct" atom | ||
when a computed atom converts to reverse implicit, | ||
|
||
- its atomState is created from scratch | ||
- this is because the atomState stores a different value for the scoped atom and can have different dependencies | ||
|
||
**Special Case:** on first read, when a computed atom reads a scoped atom, | ||
|
||
1. it is added to the reverse implicit set | ||
1. the atomState is copied from the unscoped atomState | ||
1. getAtomState points to the scoped atomState | ||
|
||
the atomStateProxy is no longer needed. | ||
|
||
# Implementation | ||
|
||
readAtomTrap: | ||
getter: |
This file contains 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
Oops, something went wrong.