Repository navigation
fix(mapbox): ignore useDevicePixels in interleaved mode - #10510
Merged
chrisgervang merged 4 commits intoJul 31, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
ibgreen
approved these changes
Jul 30, 2026
| if (this._interleaved) { | ||
| if (useDevicePixels !== undefined && useDevicePixels !== true) { | ||
| log.warn( | ||
| 'useDevicePixels has no effect in interleaved mode. The basemap controls the drawing buffer resolution. Use MapLibre pixelRatio option instead.' |
Collaborator
There was a problem hiding this comment.
While warnings are nice, this is a big string to bundle for every app for what is likely to be a rare case that would only hit during development.
Options:
- shorter string.
- assert(), then add the explanation in a comment here so that stopping in the debugger gives the developer the reason. That is what is usually done in luma/deck.
Collaborator
Author
There was a problem hiding this comment.
Moved the explanation into a code comment, so nothing extra gets bundled.
Replace the runtime warning with a code comment to avoid bundling an error string for a development-only case. Co-Authored-By: Claude Opus 4.6 <[email protected]>
…p-browser-use-device-pixels-v1
chrisgervang
deleted the
chrisgervang/basemap-browser-use-device-pixels-v1
branch
July 31, 2026 01:17
Pessimistress
pushed a commit
that referenced
this pull request
Aug 7, 2026
* fix(mapbox): warn when useDevicePixels is set in interleaved mode Co-Authored-By: Claude Opus 4.6 <[email protected]> * fix(mapbox): suppress unused variable lint warning Co-Authored-By: Claude Opus 4.6 <[email protected]> * fix(mapbox): silently drop useDevicePixels in interleaved mode Replace the runtime warning with a code comment to avoid bundling an error string for a development-only case. Co-Authored-By: Claude Opus 4.6 <[email protected]> --------- Co-authored-by: Claude Opus 4.6 <[email protected]>
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.
Closes #10509
Change List
useDevicePixelsin interleaved mode instead of forwarding it to Deck. The base map owns the WebGL context and the canvas drawing buffer size, so the prop has never had any effect there. The reason is recorded in a code comment rather than a runtime warning, to avoid bundling a string for a development-only case.filterPropsreadinginterleavedoff the incoming props (defaulting tofalse) instead ofthis._interleaved. SincesetPropsreceives partial props,setProps({useDevicePixels})on an interleaved overlay was forwarding the value.useDevicePixelsas ignored in interleaved mode in the MapboxOverlay API reference, pointing to MapLibre'spixelRatiomap option (Mapbox GL JS has no equivalent).setPropspath, and that overlaid mode still passes the prop through.Not a breaking change:
useDevicePixelshad no effect in interleaved mode in any tested version (9.1, 9.2, 9.3), so nothing that worked before stops working.Note
Low Risk
Localized prop filtering and documentation for MapboxOverlay; no auth, security, or broad rendering pipeline changes beyond avoiding a mistaken useDevicePixels forward in interleaved mode.
Overview
MapboxOverlaynow stripsuseDevicePixelswheninterleaved: true, because the basemap owns the WebGL context and canvas buffer size.filterPropsusesthis._interleavedinstead of the incominginterleavedprop (which defaulted tofalse), sosetProps({ useDevicePixels })no longer incorrectly forwards that value in interleaved mode. Overlaid mode still passesuseDevicePixelsthrough to Deck.The MapboxOverlay API docs document that
useDevicePixelsis ignored in interleaved mode and point users to MapLibre’spixelRatiomap option (no Mapbox GL JS equivalent). Tests cover constructor andsetPropsbehavior for interleaved vs overlaid.Reviewed by Cursor Bugbot for commit 45c4cc1. Bugbot is set up for automated code reviews on this repo. Configure here.