-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Bug]MapboxOverlay error when set interleaved=true on mapbox-gl@3.6.0 #9086
Labels
Comments
I think this is because mapbox has changed the return value of Map.getLayer() function: getLayer<T extends LayerSpecification>(id: string): T | undefined {
if (!this._isValidId(id)) {
return null;
}
//it returns a layer object
const layer = this.style.getOwnLayer(id);
return layer ? layer.serialize() as T : undefined;
} but from version 3.6.0: getLayer<T extends LayerSpecification | CustomLayerInterface>(id: string): T | undefined {
if (!this._isValidId(id)) {
return null;
}
const layer = this.style.getOwnLayer(id);
if (!layer) return;
//it returns an implementation directly
if (layer.type === 'custom') return (layer as CustomStyleLayer).implementation as T;
return layer.serialize() as T;
} so i changed the resolveLayers() function to this: // Step 2: add missing layers
for (const layer of layers) {
const mapboxLayer = map.getLayer(layer.id) as MapboxLayer<Layer>;
if (mapboxLayer) {
// @ts-expect-error not typed
mapboxLayer.setProps(layer.props);
//mapboxLayer.implementation.setProps(layer.props);
} else {
map.addLayer(
new MapboxLayer({id: layer.id, deck}),
// @ts-expect-error beforeId is not defined in LayerProps
layer.props.beforeId
);
}
} it works fine! |
Thanks for investigating this. I'll release a patch to handle this change. |
@Pessimistress that would be awesome!! Can you share any update on the progress? |
7 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
When setting interleaved=true, deck.gl raise an exception:
undefined is not an object (evaluating 'mapboxLayer.implementation.setProps')
and the line features on mapbox are dispeared.
Flavors
Expected Behavior
Steps to Reproduce
I created a demo project at https://codepen.io/Ze-Lin-the-encoder/pen/eYXXdZd
Environment
Logs
No response
The text was updated successfully, but these errors were encountered: