#any way to update a signal without it causing a reactive update?
8 messages · Page 1 of 1 (latest)
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
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).
Documentation for SolidJS, the signals-powered UI framework
Quickly discover what the solid compiler will generate from your JSX template
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
https://playground.solidjs.com/anonymous/f6a46d01-c21d-4fd1-9fa7-42f67e60af0b
this fixes the type issue I think.
one more thing to keep in mind is that when you use the non silent setter it will always trigger.
not a big deal, but it will allow you to trigger with the value that was set last silently.
Quickly discover what the solid compiler will generate from your JSX template