Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: inconsistent observable behavior when used with getter #7035

Open
olaf-k opened this issue Nov 28, 2024 · 1 comment
Open

fix: inconsistent observable behavior when used with getter #7035

olaf-k opened this issue Nov 28, 2024 · 1 comment
Labels
area:fast-element Pertains to fast-element bug A bug status:needs-investigation Needs additional investigation

Comments

@olaf-k
Copy link
Contributor

olaf-k commented Nov 28, 2024

🐛 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 olaf-k added the status:triage New Issue - needs triage label Nov 28, 2024
@janechu
Copy link
Collaborator

janechu commented Dec 5, 2024

@olaf-k thanks for filing this, definitely seems like a bug, looking into it!

@janechu janechu added bug A bug status:needs-investigation Needs additional investigation area:fast-element Pertains to fast-element and removed status:triage New Issue - needs triage labels Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:fast-element Pertains to fast-element bug A bug status:needs-investigation Needs additional investigation
Projects
None yet
Development

No branches or pull requests

2 participants