-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interactivity API: Refactor internal proxy and signals system #62734
Merged
+2,571
−434
Merged
Changes from all commits
Commits
Show all changes
91 commits
Select commit
Hold shift + click to select a range
181841a
WIP
DAreRodz e78df31
More WIP
DAreRodz 80c1da9
Restore previous packages
DAreRodz 852bc99
Fix current tests
DAreRodz 0688cff
Add computation tests
DAreRodz 4dec758
Fix getter call
DAreRodz dace302
Fix for..in on new properties
DAreRodz 20923cb
Refactor code a little
DAreRodz 38c4ca8
Add tests for getters with scope
DAreRodz 98163be
Move namespaces to properties
DAreRodz 55cca00
Fix a problem with object references
DAreRodz 8711d38
Add store handlers
DAreRodz 349a257
Add signals-core dependency
DAreRodz fc7a39b
Rename Property to PropSignal
DAreRodz 0df6219
Move withScope inside PropSignal logic
DAreRodz 61b1da5
Create proxies folder
DAreRodz 3401a2b
Attempt to make the context work
DAreRodz 5a546eb
Reorganize code
DAreRodz d375418
Make peek() return only the value inside signalValue
DAreRodz 075c4f9
A bit of refactoring
DAreRodz b9f5ac8
Return the computed value with `peek()`
DAreRodz a9a5fb0
Rename DEFAULT_SCOPE to NO_SCOPE
DAreRodz c9a854c
Remove deepsignal
DAreRodz fc131dc
Handle functions inside state
DAreRodz fe0b6bb
Fix withScope in this PR
DAreRodz e371add
Fix context proxification
DAreRodz fe1920d
Move store root logic to store proxy handlers
DAreRodz b471609
Move store initialization inside init
DAreRodz 164d92e
Add TODO comment inside `peek()`
DAreRodz c06f6bf
Fix store root assignments
DAreRodz 747c822
Fix lint error
DAreRodz 7938dd8
Enable skipped test for non-initialized getters
DAreRodz c238ede
Rename get(State|Store)Proxy to proxify(State|Store)
DAreRodz 3cf82a1
Make `getContext` throw when there is no scope
DAreRodz 99f6e87
Fix `proxifyState` types
DAreRodz 821532e
Rename some variables in tests
DAreRodz 2dc4548
Add test for object reference keeping
DAreRodz c720d0f
Rename test suite for state proxy
DAreRodz 8de7b83
Add tests for getters and functions with scope
DAreRodz 4bac1a8
Add tests for prop subscription inside functions
DAreRodz 5e508c1
Allow functions to use `this`
DAreRodz a4840a0
Minor fixes
DAreRodz d17f4bd
Add tests to store proxies
DAreRodz d64eee3
Throw an error when an object cannot be proxified
DAreRodz 22f5244
Change peek implementation
DAreRodz 82622aa
Add tests for peek and unsupported structures
DAreRodz 43dcfec
Test peeking getters that access scope or other namespaces
DAreRodz e2b2e61
Ignore well-known symbols
DAreRodz 0bd1050
Minor comment format fix
DAreRodz 53c3939
Move namespace arg to first position in proxify functions
DAreRodz e294bba
chore: Update jest.config.js to stop ignoring deepsignal because we r…
michalczaplinski c0c633e
Add comments to proxy registry
DAreRodz 1e1aa6a
Remove namespace from PropSignal
DAreRodz 5648754
Remove unused `peekValueSignal` method
DAreRodz d2f849f
Simplify PropSignal methods
DAreRodz 573ce9d
Add TSDocs to PropSignal
DAreRodz 0950fa8
Disable unused vars lint rule in state-proxy tests
DAreRodz 236e389
Remove descriptor alias
DAreRodz 8bcb576
Expand `getProxyNs` docs
DAreRodz 1b7d2df
Add more comments in `state`
DAreRodz 4554fb4
Refactor state functions and add tsdocs
DAreRodz 5cce756
Fix some grammar issues
DAreRodz 86a5b5a
Fix default namespace for setters
DAreRodz cebfd6e
Replace `isNotRoot` with `isRoot`
DAreRodz 0e2b095
Update comments in store.ts
DAreRodz a12732c
Move `isPlainObject` to utils
DAreRodz 0667028
Remove remaining deepSignal references
DAreRodz 9a52b65
Delete unnecessary @ts-ignore-next-line
luisherranz b21a3ce
Use `isPlainObject` from utils inside store
DAreRodz e8c5458
Move scopes and namespaces to separate files
DAreRodz 6d1d887
Call `init` outside `DOMContentLoaded`
DAreRodz 4dccb45
Replace `signals-core` imports with `signals`
DAreRodz fee316d
Rename `proxiedStore` to `proxifiedStore`
DAreRodz 52373b1
Remove unnecessary `peek()` call
DAreRodz 55a9d01
Throw more descriptive errors from getContext and getElement
DAreRodz ff9c901
Use more descriptive name for proxy functions
DAreRodz 68de3b6
Use destructured `get` inside `setGetter` call
DAreRodz 1009a4f
Add comment to explain `objToIterable` signals subscription
DAreRodz 2e5c926
Change line comment to block comment
DAreRodz 2aaf909
Replace `?` with `!` operator
DAreRodz 1ff465d
Wrap Interactivity API tests with appropriate `describe`
DAreRodz b470cc2
Remove unnecessary `setNamespace` calls in tests
DAreRodz 65dfdf8
Remove duplicated test
DAreRodz e0272f8
Fix typo
DAreRodz 4db4bff
Add extra tests for getter modification
DAreRodz 80e9ff5
Test the right namespace is used inside getters
DAreRodz 80cf598
Fix test name
DAreRodz 28d329b
Check if length's PropSignal exists before updating its value
DAreRodz 0efe2c2
Add deepMerge tests and prevent server overwritting
luisherranz 31ad6a9
Make sure context inheritance is shallow and server props don't overw…
luisherranz 185ec72
Refactor wp-each to use new proxifyContext structure
luisherranz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to keep doing a deep clone of the object? If I'm not mistaken, objects are no longer merged on each context, so there is only a unique object for each context. Is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhm, if I remember correctly, I added that because the parsed JSON defined in the
data-wp-context
directive―i.e., the object returned bytoVdom()
as a prop―was being modified and that caused some sort of trouble during client-side navigation.Maybe that won't be needed once we fix #63864. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... do you know by who?
toVdom
creates new objects on each run, doesn't it?gutenberg/packages/interactivity/src/vdom.ts
Line 105 in 644264c