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(runtime-core/scheduler): handle out-of-order invalidateJobs #2982

Closed
wants to merge 1 commit into from

Conversation

mfro
Copy link

@mfro mfro commented Jan 10, 2021

In cases where invalidateJob is called on a job that has already started (i <= flushIndex), the remaining contents of queue gets shifted and the job immediately after the current job is skipped.

https://github.com/vuejs/vue-next/blob/af9560455d9719a4c5f0d6588d04bfb4c06c8654/packages/runtime-core/src/scheduler.ts#L87-L92

https://github.com/vuejs/vue-next/blob/af9560455d9719a4c5f0d6588d04bfb4c06c8654/packages/runtime-core/src/scheduler.ts#L211-L219

I haven't been able to come up with a good minimal demo of this bug, but hopefully the modifications to the test case can serve as a sufficient example of a scenario that would cause this bug to occur. If the modified test case is run without the fix, job1 being invalidated would cause job4 to be skipped.

For what its worth here's a non-minimal repro:
https://mfro.me/chess/ - built with my fork, includes fix
https://mfro.me/chess-vuerepro/ - built with v3.0.5, no fix
The most noticeable change in behavior is when making 2 consecutive moves on the chess board. The game notation to the right of the board does not update properly for the second or later moves.

@HcySunYang
Copy link
Member

Thanks to your PR, but see this #3184

@HcySunYang
Copy link
Member

Closed because it is stale

@HcySunYang HcySunYang closed this Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants