Closed mbarrenechea closed 2 years ago
This PR adds a better way of handling deck layers. You only need to memoize the layer using a useMemo a listen to changes to re render the new layer.
useMemo
The key part is that we are now listening from layer manager mapbox plugin to the changes in deck layers.
setDeck(layerModel) { const { mapLayer, deck } = layerModel; mapLayer?.layers?.forEach((layer, i) => { if (layer && layer.setProps && typeof layer.setProps === 'function') { const dl = deck[i - 1]; if (dl) { const { props: deckProps } = dl; layer.setProps(deckProps); } else { console.warn('No deck layer found for layer', layer); } } });
The latest updates on your projects. Learn more about Vercel for Git ↗︎
This PR adds a better way of handling deck layers. You only need to memoize the layer using a
useMemo
a listen to changes to re render the new layer.The key part is that we are now listening from layer manager mapbox plugin to the changes in deck layers.