From f633a3d7b9c1e07e7e19b8d2d9bb88eec4e64b01 Mon Sep 17 00:00:00 2001 From: Peter Todd Date: Sat, 20 Jun 2026 12:50:39 +0100 Subject: [PATCH 1/2] when there's only one coordinate-system, select it by default. --- packages/vis/src/SpatialCanvas/index.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/vis/src/SpatialCanvas/index.tsx b/packages/vis/src/SpatialCanvas/index.tsx index 3329fb74..c2545b8e 100644 --- a/packages/vis/src/SpatialCanvas/index.tsx +++ b/packages/vis/src/SpatialCanvas/index.tsx @@ -457,16 +457,16 @@ function SpatialCanvasInner({ vw, ]); - useEffect(() => { - if (coordinateSystems.length > 0 && !coordinateSystem) { - actions.setCoordinateSystem(coordinateSystems[0]); - } - }, [coordinateSystems, coordinateSystem, actions]); - useEffect(() => { actions.reset(); - if (coordinateSystem && coordinateSystems.includes(coordinateSystem)) { - actions.setCoordinateSystem(coordinateSystem); + const nextCoordinateSystem = + coordinateSystem && coordinateSystems.includes(coordinateSystem) + ? coordinateSystem + : coordinateSystems.length === 1 + ? coordinateSystems[0] + : null; + if (nextCoordinateSystem) { + actions.setCoordinateSystem(nextCoordinateSystem); } }, [coordinateSystem, coordinateSystems, actions]); From 6b91310ee6a610237bc74ba08f9111867cfacb99 Mon Sep 17 00:00:00 2001 From: Peter Todd Date: Thu, 2 Jul 2026 07:10:33 +0100 Subject: [PATCH 2/2] add changeset for default coordinate-system selection Co-Authored-By: Claude Fable 5 --- .changeset/default-coordinate-system-selection.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/default-coordinate-system-selection.md diff --git a/.changeset/default-coordinate-system-selection.md b/.changeset/default-coordinate-system-selection.md new file mode 100644 index 00000000..682f8cef --- /dev/null +++ b/.changeset/default-coordinate-system-selection.md @@ -0,0 +1,5 @@ +--- +"@spatialdata/vis": patch +--- + +Auto-select the coordinate system when a SpatialData object has exactly one. Previously the picker started unselected (showing "Select a coordinate system") even when there was only one choice, and a separate effect would eagerly pick the first of several. Now selection defaults only in the unambiguous single-coordinate-system case; multi-system datasets still require an explicit choice.