Describe the bug
When updating parent signal and derived signal in one "batch", the derived signal update has no effect independent of update order.
const [original, setOriginal] = createSignal(0);
const [derived, setDerived] = createSignal(original);
function onClick() {
setOriginal(1); // sets both derived signals to 1
setDerived(2); // doesn't do anything
}
This happens only for first call of onClick, because on second call original signal already has new value and so doesn't update - this allows derived signal to update.
This can be mitigated right now with flush
function onClick() {
setOriginal(1); // sets both derived signals to 1
flush();
setDerived(2); // sets derived signal to 2
}
but flush can't be used in e.g. onSettled
and flushing it at that point makes more updates
Your Example Website or App
https://s.olid.uk/id/iMjvvK2zQbi-c6TJvUWsDA
Steps to Reproduce the Bug or Issue
- Go to link
- Click the button
- See that both signals have value of 1 instead of 1 and 2
- Click the button again
- See that signals have now values of 1 and 2
Expected behavior
Updates to signals should be applied in call order.
Screenshots or Videos
No response
Platform
- OS: Windows 10
- Browser: Chrome
- Version: Solid v2.0.0-beta.10
Additional context
No response
Describe the bug
When updating parent signal and derived signal in one "batch", the derived signal update has no effect independent of update order.
This happens only for first call of
onClick, because on second call original signal already has new value and so doesn't update - this allows derived signal to update.This can be mitigated right now with
flushbut
flushcan't be used in e.g.onSettledand flushing it at that point makes more updates
Your Example Website or App
https://s.olid.uk/id/iMjvvK2zQbi-c6TJvUWsDA
Steps to Reproduce the Bug or Issue
Expected behavior
Updates to signals should be applied in call order.
Screenshots or Videos
No response
Platform
Additional context
No response