Bypass the DOM rendering queue if map is idle #10567
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.
In #10530 I added a new queue dedicated to the rendering of DOM elements. Unfortunately I made the mistake to run this new queue only in
map._render()
, which won't be called if the map is idle. You can test this problem by trying to move a marker once the map is fully loaded and rendered inmarkers.html
.A mechanism like
map._requestRenderFrame()
could be added, but I feel there is no need to call the whole_render()
loop all over again for a simple rendering of a DOM element. As far as I understand, this problem happens only when very few elements are moving/rendering. So I'm proposing to call directly the dom task, like it was the case before, only if the map is idle. The condition I choose is the same inui/map
, right before setting the map idle.Note that preventing the map to go idle if there are still some tasks in
domRenderTaskQueue
won't work, as the queue could be filled while the map is already idle.Tagging @mourner as he followed the previous PR.
Sorry about this mistake, I though I checked correctly in the other PR.