#any way to update a signal without it causing a reactive update?

8 messages · Page 1 of 1 (latest)

elder verge
unique plinth
#

My solution would be to use a regular variable instead, and have the other page actively pull from there when rendering. If you also want to sometimes have reactive updates, then you can write an abstraction that allows controlling whether only the variable gets modified, or if the signal gets updated

#

It's certainly not possible to prevent an update when calling the setter (untrack works for the read side, so it doesn't subscribe. But you can't set a setter and expect listeners to not update, excluding batch rules which just defer of course )

#

You probably want an abstraction then, that allows you to control that

elder verge
#

Just some thoughts:

the entries are a resource

And as such represent "server state"

then the entire page re-renders

This happens because you have the entire list in a signal. For the list to change the entire list has to change, consequently the entire page updates. What you want is fine-grained reactivity with a store.

There you can use reconcile to merge server state with local state. At that point adding a new entry doesn't update the entire page (like keeping the whole list of entries in a signal does).

dense bobcat
#

not really.

if your use case need an unreactive signal update, that is one way to do that.

it will just shift the control to you, when you might want to trigger the change