Skip to content

fix: Ensure we reset state when changing sources in MultiCOGLayer#414

Merged
kylebarron merged 1 commit intomainfrom
kyle/fix-multi-cog-layer-switch-sources
Apr 10, 2026
Merged

fix: Ensure we reset state when changing sources in MultiCOGLayer#414
kylebarron merged 1 commit intomainfrom
kyle/fix-multi-cog-layer-switch-sources

Conversation

@kylebarron
Copy link
Copy Markdown
Member

@kylebarron kylebarron commented Apr 10, 2026

For #142, related to #147

Previously, switching sources rendered old data. Now, we correctly render the latest data whenever we switch sources.

Screen.Recording.2026-04-10.at.3.25.28.PM.mov

Root cause: _parseAllSources() is async, but renderLayers() runs synchronously after updateState. The new TileLayer was created with new props-derived sourceUrls in its id/updateTriggers, causing tile re-fetches. But _getTileData read band data from this.state.sources which still held the old source map. Tiles were cached under the new TileLayer with wrong band names, and when _parseAllSources finally completed, the cached tiles persisted — causing _renderSubLayers to return null (required bands missing).

@github-actions github-actions bot added the fix label Apr 10, 2026
@kylebarron kylebarron enabled auto-merge (squash) April 10, 2026 19:29
@kylebarron kylebarron merged commit ea73fa1 into main Apr 10, 2026
5 checks passed
@kylebarron kylebarron deleted the kyle/fix-multi-cog-layer-switch-sources branch April 10, 2026 19:29
@ds-release-bot ds-release-bot bot mentioned this pull request Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant