fast
fast copied to clipboard
fix: inconsistent observable behavior when used with getter
🐛 Bug Report
I recently stumbled on a strange behavior where this code works:
${when((x) => x.myObservable && x.myGetter, html(...snip...)
but not this one:
${when((x) => x.myGetter && x.myObservable, html(...snip...)
meaning that only the first example properly reacts when myObservable's value changes.
💻 Repro or Code Sample
https://stackblitz.com/edit/vitejs-vite-davib1?file=src%2Fmain.ts
To elaborate on the scenario: myGetter is updated but should not trigger when (so no need to make it an observable). myObservable is the one whose value should drive the template updates.
🤔 Expected Behavior
Both expressions should result in the same behavior.
💁 Possible Solution
I didn't have time to dig into the observable implementation, sorry. Maybe some kind of memoization is involved?
@olaf-k thanks for filing this, definitely seems like a bug, looking into it!