-
-
Notifications
You must be signed in to change notification settings - Fork 717
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 flicker on map resize #4429
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4429 +/- ##
==========================================
- Coverage 87.88% 87.73% -0.16%
==========================================
Files 246 246
Lines 33450 33451 +1
Branches 2208 2217 +9
==========================================
- Hits 29399 29347 -52
- Misses 3050 3101 +51
- Partials 1001 1003 +2 ☔ View full report in Codecov by Sentry. |
Looks good, can you fix the failing tests, and add another test if needed please? |
Not sure how to debug the failing test yet. I can confirm that |
npm run test-unit --reportes=default |
Any updates on this? |
It seems like merging main fixed the test... Trying again to make sure it's not a fluke. |
I'm not sure I understand how this solves the problem. Also, as stated before, please add a test for this bug. |
@HarelM I think it’s a timing problem. _update() calls triggerRepaint(), which calls _render(), but in testing this I noticed that since the _render() call is in this browser.frameAsync callback, it happens after about a ~10ms delay, compared to if it’s called directly in the resize handler, like in this commit. When I add an explicit 10ms delay before the new _render() call in the resize handler, the flicker comes back. Perhaps this points to a simpler solution. |
Maybe #4535 can help here too? |
This needs a test nevertheless, but if #4535 solves this, it will be a better solution from my point of view. |
Unfortunately thats not the case. I can reproduce the flicker in that branch. |
Closing in favor of: If the linked PR is not enough, please comment on it or comment in the linked closed issue. |
Fixes #2971 and #4158. Flicker on resize was introduced in #2157, released in v3.0.0, when map resizing was switched to using resizeObserver from using window resize events.
The fix is to immediately render the map upon resizing. The lead was this thread.
Caveat: I'm not sure what to pass for the
paintStartTimeStamp
formap._render()
. I set it toDate.now()
.0
also works fine.Before and after gifs (half speed):
CHANGELOG.md
under the## main
section.