fix binding out of sync on reactive update #3886
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Should fix #3382
The bug is caused by
updating_count
inApp
being set totrue
on bound afterRefactoredButton
click . Whencount
is updated reactively inApp
,updating_count
is stilltrue
(because it has not been flushed yet), hence setting the final value ofcount
back toRefactoredButton
is skipped.This solution is to move setting
updating_count
(and flush callback) from binding top
. The reason is, I believe, updating in binding does not entirely represent updating of a component i.e. the way parent updates and passes the props to its children is only throughp
and it should also be considered updating.I hope my understanding is correct and this change does not create any unexpected behaviours. I have also added a new test case for this.
Thanks and appreciate for your review!
PS: Sorry, I closed the previous PR when I thought it didn't pass the CI 😓, but I think it's unrelated from my changes 🤔.