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

Derived store comparison logic differs from others #2644

Closed
Rich-Harris opened this issue May 1, 2019 · 1 comment · Fixed by #2695
Closed

Derived store comparison logic differs from others #2644

Rich-Harris opened this issue May 1, 2019 · 1 comment · Fixed by #2695
Labels

Comments

@Rich-Harris
Copy link
Member

REPL. Normally with stores we use conservative comparison logic — if a value is a non-primitive, then set or update is considered to have changed the value even if it has referential equality.

That's not the case with derived stores. This causes surprising behaviour when you're reusing objects, as is common in WebGL programming.

@Rich-Harris Rich-Harris added the bug label May 1, 2019
@PixievoltNo1
Copy link

What's even weirder is that this difference only applies when the callback given to derived is lacking a set parameter. Here's another REPL to demonstrate.

I can see the bug in line 58 of store.mjs. I don't see why the if-condition needs to be anything more than auto; wouldn't the set call be able to do the needed equality check on its own?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants