-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
Description
Description
It seems #8776 is not fully solved.
An inconsistent behavior is observed when data is resolved from a promise.
Flavors
- Script tag
- React
- Python/Jupyter notebook
- MapboxOverlay
- GoogleMapsOverlay
- CARTO
- ArcGIS
Expected Behavior
Nothing should be rendered when the data array is empty.
Steps to Reproduce
I have used the same example as in #8776 but setting data
to promises:
const {DeckGL, TextLayer} = deck;
let data = ['Foo Bar'];
const deckInstance = new DeckGL({
mapStyle: 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json',
initialViewState: {
longitude: 0,
latitude: 51,
zoom: 8,
},
layers: []
});
function redraw() {
const layer = new TextLayer({
id: 'TextLayer',
data,
getPosition: d => [0, 51, 0],
getSize: 16,
getText: d => d,
});
deckInstance.setProps({ layers: [layer] });
}
document.addEventListener('click', () => {
if (data.length === 0) {
data = Promise.resolve(['Foo Bar']);
} else {
data = Promise.resolve([]);
}
redraw();
});
redraw();
Environment
- Framework version:
deck.gl/[email protected]
- Browser: Firefox 143.0.1
- OS: MacOS Sequoia 15.7
Logs
No response