-
Notifications
You must be signed in to change notification settings - Fork 1k
[labs/signals] watch() no longer triggers update; adds effect #4941
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
Conversation
🦋 Changeset detectedLatest commit: 3613282 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📊 Tachometer Benchmark ResultsSummarynop-update
render
update
update-reflect
Resultsthis-change
render
update
update-reflect
this-change, tip-of-tree, previous-release
render
update
nop-update
this-change, tip-of-tree, previous-release
render
update
this-change, tip-of-tree, previous-release
render
update
update-reflect
|
|
The size of lit-html.js and lit-core.min.js are as expected. |
| } | ||
|
|
||
| export interface ElementEffectOptions extends EffectOptions { | ||
| element?: SignalWatcher & SignalWatcherApi; |
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.
JSDocs here?
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.
Removed, no longer needed.
| manualDispose?: boolean; | ||
| } | ||
|
|
||
| export interface ElementEffectOptions extends EffectOptions { |
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.
Is this interface used anywhere?
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.
Removed, no longer needed.
justinfagnani
left a comment
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.
Awesome!
Two small comments left
|
Getting into some finer testing of this change as we await it landing and wondered which of these is "correct". In https://lit.dev/playground/#gist=5cfb3e893dbc5412ed1468483be5fa80 we get the render lifecycle on all three buttons, but only the Signal bindings on the first and last (signal powered) element. In https://lit.dev/playground/#gist=3b14cb4a58de364ec7686f230a88435d we do not get the render lifecycle in either of the Signal bindings. Maybe there's changes in this PR before I lifted the code, but wanted to confirm as we're working out how we want to consumer these capabilities in my team right now. |
|
Forwarded from discord
|
Fixes #4860.
watchno longer triggers a reactive update on aSignalWatcherelementwatchcan be used withoutSignalWatchereffect(callback, options)which runs the provided function whenever any signals it accesses are changed. If anoptionsobject is provided, the effect is coordinated with the givenelementand is called by default after rendering updates but can optionally include an optionsbeforeUpdate: trueto process the effect before any rendering updates.