Closed XantreDev closed 1 year ago
Latest commit: 5c72e9ae2e32c87e87adda2a24c1a4520089c67d
The changes in this PR will be included in the next version bump.
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
Name | Link |
---|---|
Latest commit | 5c72e9ae2e32c87e87adda2a24c1a4520089c67d |
Latest deploy log | https://app.netlify.com/sites/preact-signals-demo/deploys/64c024072037800008e67821 |
Deploy Preview | https://deploy-preview-380--preact-signals-demo.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
@andrewiggins I will be appreciate if you give feedback)
Hey! One question that comes to mind for me is what use case does this help that use const value = signal.peek()
doesn't work for?
Some reasons is specified in proposal linked to the PR.
But shortly: its useful for creating utils that works with callbacks. Most of reactive runtime provides untracked
, so it's common pattern, that allows to manipulate reactivity not on sender side, but in consumer side.
Yes, I can emulate untracked with computed, but it has too much overhead IMHO.
const untracked = (callback) => computed(callback).peek()
And I am not sure that I can modify values in computed, it feels weird
Oh whoops! I missed the linked proposal. Lemme take a look and mull it over with the team
I think this thing are essential for writing Store-like primitives and dealing with it without tricks
@andrewiggins when you will return with feedback?
I have some vacation coming up so will be away for a week or two. Though if other core team members have thoughts, no need to block on me
@JoviDeCroock what do you think about untracked
?
This looks good to me, tests seem to be failing and needs a changeset
This looks good to me, tests seem to be failing and needs a changeset
Fixed
Thanks a lot👍
Resolves https://github.com/preactjs/signals/issues/378
As mentioned in the proposal this allows us to write effects that essentially aren't re-executed by the signals that get accessed in the function body of
untracked
.Allowing functionality like