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

Multiple queued renders in response to changing styles #4765

Open
tomhicks opened this issue Sep 26, 2024 · 1 comment
Open

Multiple queued renders in response to changing styles #4765

tomhicks opened this issue Sep 26, 2024 · 1 comment
Labels
need more info Further information is requested

Comments

@tomhicks
Copy link
Contributor

maplibre-gl-js version: 4.7.x

browser: All

Steps to Trigger Behavior

  1. Have a complex map with lots to render
  2. Set the style rapidly, such as in response to a hover
  3. Renders are queued up, sequentially rendering old states through to the new one

Link to Demonstration

Sorry that this is the complete opposite of a minimal reproduction, however it's the best way I know to make a complex enough map.

https://felt.com/map/Untitled-Map-3W49ADnfJTKyOC9AHrmlO9BSB?loc=51.472,7.718,6.74z

If you run your mouse rapidly over the very dense cycle network of the Netherlands and Germany, you can see our highlighting in pink plays catchup, sometimes over a number of seconds, leaving a trail of pink highlights.

I know that we should probably be using feature state for highlights, but there are other cases that we have avoided surfacing in our production app where this happens when rapidly changing styles in other ways.

Expected Behavior

I would expect the renders not to be queued up and if it's lagging to only render the latest state, or something.

I have tried to implement this in user-land by doing something like only setting the next style once a "render" event has been received, but that doesn't seem to help. I have a feeling that this might be something cascading being triggered from within the render callback itself. I also note that there seems to be a cancellation mechanism in the render queuing, but I've been unsuccessful in trying to hack that so far.

Actual Behavior

The map queues up a series of renders/draws, leaving a "trail" of old states being shown on screen.

@HarelM
Copy link
Collaborator

HarelM commented Sep 29, 2024

The issue can be seen from the above link, but it is not clear what you did to cause this issue, much like posting a video of this issue, I guess.
I would recommend rechecking your code to see what can be done to solve this better.
I'm not sure the solution should be to drop render requests, but it's hard to give a good advice without really understanding the issue at hand.
I would still recommend trying to create a minimal reproduction.

@HarelM HarelM added the need more info Further information is requested label Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need more info Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants