Open
Description
Describe the bug
Open console in this repl
in synchronous for loop store.subscribe
runs callback for each set
, while reactive $:
runs only on last set
const store = writable(0);
setTimeout(() => {
for (let i = 1; i <= 10; ++i) {
store.set(i); // syncronous set calls
}
});
$: console.log('$:', $store); // logs only last value
store.subscribe(v => console.log('subscribe', v)); // logs each value
Expected behavior
Autosubscription and manual subscription should behave the same way or explained in documentation
Severity
Might broke some logic, if you expect all callback of set
to run in autosubscription.
I think this should be clarified in documentation.