Describe the problem
Thanks for your work. We are migrating from v4 to v5 and were wondering if it would be possible to add an additional $effect.every rune to handle cases that currently work perfectly with v4 but would require a complete rewrite in v5.
An effect only depends on the values that it read the last time it ran. If a is true, changes to b will [not cause this effect to rerun]
$effect(() => {
console.log('running');
if (a || b) {
console.log('inside if block');
}
});
we have Svelte 4 code like this :
$: {
console.log('running');
if (a || b) {
console.log('inside if block');
}
}
and it would be nice 'inside if block' is printed at every change of a and b. This would be useful as well as save us time in migrating from v4 to v5
Describe the proposed solution
introduce the rune $effect.every force rerun on every state change which does not depend on the last read value
example:
$effect.every(() => {
console.log('running');
if (a || b) {
console.log('inside if block');
}
});
'inside if block' is printed if a or b is changed.
Thanks!
Importance
would make my life easier