fix(web): recreate Cesium3DTileset and ClippingPlaneCollection when tile source changes - #150
Merged
Merged
Conversation
…ile source changes
wilfredmulenga
approved these changes
May 26, 2026
airslice
reviewed
May 26, 2026
airslice
requested changes
May 26, 2026
wilfredmulenga
self-requested a review
May 26, 2026 10:14
airslice
approved these changes
May 27, 2026
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.
Fixed a bug where switching the 3D tileset source type (e.g. from OSM to URL) in the layer panel would not display the new tileset until the user toggled layer visibility off and on.
Overview
When switching between tile source types (osm → url, or changing the tileset URL), the Cesium3DTileset component was not being recreated because no key prop was set on it. This caused resium to attempt a prop update on the existing Cesium object, but url is a constructor-only option in CesiumJS and cannot be changed after instantiation — so the tileset silently stayed on the old source.
A secondary but more critical issue was in how ClippingPlaneCollection was managed. It was created once via useState and shared across the lifetime of the Tileset component. When a Cesium3DTileset is destroyed (on unmount), CesiumJS internally calls destroy() on its attached ClippingPlaneCollection. With the key-based fix in place, unmounting the old tileset would destroy the shared collection, and the newly mounted tileset would receive an already-destroyed ClippingPlaneCollection, causing it to silently fail to render.
Toggling visibility worked as a workaround because it unmounted the entire Tileset React component, triggering a useState re-initialization that created a fresh ClippingPlaneCollection.
What I've done
Affected File
web/src/classic/components/molecules/Visualizer/Engine/Cesium/Tileset/index.tsx
What I haven't done
How I tested
Which point I want you to review particularly
Memo