test(workbench): cover junction workspace deep links

This commit is contained in:
que01 committed 2026-09-03 12:35:45 +08:00
1 parent 8c99bb7340
commit b7d9a1973e
2 files changed
+28

No files matched your search

+11
View File
@@ -178,6 +178,17 @@ function App() {
() => (state && junctionRoute ? hotspotAt(junctionDescriptors(state), junctionRoute) : null),
[junctionRoute, state],
);
// A deep link starts without a map click, so it has no selected approach from
// which the existing manifest loader can scope its request. Pick the first
// descriptor-owned approach here as well as in the click path; this is a
// selection convenience only, never a second JunctionTools data source.
useEffect(() => {
if (!junctionDescriptor || !state || junctionDescriptor.ref.type !== 'node') return;
const approach = junctionDescriptor.approachRoadIds
.map((roadId) => state.compiled.model.roads.find((road) => road.id === roadId))
.find((road): road is Road => Boolean(road));
if (approach) setSelected(approach);
}, [junctionDescriptor, state]);
useEffect(() => {
if (!junctionRoute) {
setJunctionSession(null);