Sort new renderqueue items#2396
Merged
marvinhagemeister merged 7 commits intopreactjs:masterfrom Mar 6, 2020
jviide:sort-new-renderqueue-items
Merged
Sort new renderqueue items#2396marvinhagemeister merged 7 commits intopreactjs:masterfrom jviide:sort-new-renderqueue-items
marvinhagemeister merged 7 commits intopreactjs:masterfrom
jviide:sort-new-renderqueue-items
Conversation
marvinhagemeister
approved these changes
Mar 6, 2020
Member
marvinhagemeister
left a comment
There was a problem hiding this comment.
This is so good!! Really excited about this PR 🙌 ❤️
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request attempts to fix #2393 by modifying how the global
renderQueueis processed.Currently
renderQueueis sorted by vnode depth before its items are processed, but if new items get queued during processing (andrenderQueue.length > 1) then those new items are also processed without them getting sorted by depth first.This pull attempts fixing that. When
renderQueueis processed, it's item count is checked. If there are no items then we can stop. Otherwise the queue is sorted by depth and stored into a temporary variable whilerenderQueueitself is reinitialized with a new, empty array. Now the "old" queued items get processed and any new items get added to the newrenderQueuelist.After the all old items have been processed the new
renderQueueis checked & sorted again, and the cycle starts anew.A great test from @JoviDeCroock's alternative PR #2395 is also included here.
Fixes #2393