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

Compound operators don't work in reactive statements #3634

Closed
blackwolf12333 opened this issue Sep 29, 2019 · 5 comments
Closed

Compound operators don't work in reactive statements #3634

blackwolf12333 opened this issue Sep 29, 2019 · 5 comments
Labels

Comments

@blackwolf12333
Copy link
Contributor

Describe the bug
Compound operators don't work in reactive statements, I suspect this has to do with the fact that there are no variables the assignment depends on. So it is not run when the value of the left hand side of the operator changes.

To Reproduce

REPL

Expected behavior
In the REPL example when clicking the button the first time count should be 2 and after pressing the button a second time the count should be 6.

Severity

Slightly annoying but easily worked around by not using compound operators.

@Conduitry Conduitry added the bug label Sep 29, 2019
@Conduitry
Copy link
Member

I haven't checked this, but I believe what needs to be done for there is to make the identifier in UpdateExpressions here also be added as a dependency.

blackwolf12333 added a commit to blackwolf12333/svelte that referenced this issue Sep 29, 2019
blackwolf12333 added a commit to blackwolf12333/svelte that referenced this issue Sep 29, 2019
…dency

Compound assignments ('x += y', 'x *= y', etc) should have the
left-hand side of the assignment as a dependency.
blackwolf12333 added a commit to blackwolf12333/svelte that referenced this issue Sep 29, 2019
blackwolf12333 added a commit to blackwolf12333/svelte that referenced this issue Sep 29, 2019
…dency

Compound assignments ('x += y', 'x *= y', etc) should have the
left-hand side of the assignment as a dependency.
@blackwolf12333
Copy link
Contributor Author

It was actually the AssignmentExpression. PR will be done soonish.

@Conduitry
Copy link
Member

Ah, yep, it looks like UpdateExpression is for ++ and --. But I think those should be considered dependencies as well.

@blackwolf12333
Copy link
Contributor Author

I'm not sure how, but for some reason that already works. I'll see if I can find out how that works tomorrow and add a test to make sure it keeps on working.

blackwolf12333 added a commit to blackwolf12333/svelte that referenced this issue Sep 30, 2019
blackwolf12333 added a commit to blackwolf12333/svelte that referenced this issue Sep 30, 2019
…dency

Compound assignments ('x += y', 'x *= y', etc) should have the
left-hand side of the assignment as a dependency.
@blackwolf12333
Copy link
Contributor Author

@Conduitry Pull request is over here

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

No branches or pull requests

2 participants