Svelte: Compound operators don't work in reactive statements

Created on 29 Sep 2019  路  5Comments  路  Source: sveltejs/svelte

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.

bug

All 5 comments

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.

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

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

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.

@Conduitry Pull request is over here

Was this page helpful?
0 / 5 - 0 ratings

Related issues

plumpNation picture plumpNation  路  3Comments

sskyy picture sskyy  路  3Comments

clitetailor picture clitetailor  路  3Comments

juniorsd picture juniorsd  路  3Comments

robnagler picture robnagler  路  3Comments