Spotted while shipping #452 (unified File menu); deferred as out of scope there.
What happens
Importing a Dashboard onto an exact active Dashboard drops the user back to the
Query surface, even though they imported into the Dashboard they were
looking at.
Why
planImportDashboard(..., mode: 'copy', ...) remints the document id
(src/workspace/import-planner.ts:453-455):
const finalDashboard: DashboardDocumentV1 = mode === 'copy'
? { ...rewritten.dashboard, id: genId(), revision: 1 }
: rewritten.dashboard;
replaceDashboard then swaps it into the target's slot under the NEW id, so the
id held in mainSurface.dashboardId no longer resolves. The commit projection
runs reconcileMainSurface, which correctly refuses to guess and falls back to
QUERY_SURFACE (src/application/main-surface.ts:130), and app.ts's
lost-selection path then rewrites the route and repaints Query
(src/ui/app.ts:1751-1760, :1815-1828).
Every step is behaving as designed. The composite outcome is still wrong for the
user.
Why deferred
Pre-existing (predates #452) and orthogonal to "one File menu" — #452 changed
which Dashboard is targeted, not what happens after the commit. Fixing it means
re-selecting the imported document after a successful commit, which needs the
minted id threaded back out of the commit (the data channel on
mutateWorkspace can carry it) and an openDashboard call — a behaviour change
#452 does not ask for. It is currently PINNED by test, not fixed.
Suggested fix
Thread the imported Dashboard's new id back through commitWorkspace's data
channel and app.openDashboard({ dashboardId: newId, mode: 'edit' }) on success,
so an import lands the user on what they just imported.
Spotted while shipping #452 (unified File menu); deferred as out of scope there.
What happens
Importing a Dashboard onto an exact active Dashboard drops the user back to the
Query surface, even though they imported into the Dashboard they were
looking at.
Why
planImportDashboard(..., mode: 'copy', ...)remints the document id(
src/workspace/import-planner.ts:453-455):replaceDashboardthen swaps it into the target's slot under the NEW id, so theid held in
mainSurface.dashboardIdno longer resolves. The commit projectionruns
reconcileMainSurface, which correctly refuses to guess and falls back toQUERY_SURFACE(src/application/main-surface.ts:130), andapp.ts'slost-selection path then rewrites the route and repaints Query
(
src/ui/app.ts:1751-1760,:1815-1828).Every step is behaving as designed. The composite outcome is still wrong for the
user.
Why deferred
Pre-existing (predates #452) and orthogonal to "one File menu" — #452 changed
which Dashboard is targeted, not what happens after the commit. Fixing it means
re-selecting the imported document after a successful commit, which needs the
minted id threaded back out of the commit (the
datachannel onmutateWorkspacecan carry it) and anopenDashboardcall — a behaviour change#452 does not ask for. It is currently PINNED by test, not fixed.
Suggested fix
Thread the imported Dashboard's new id back through
commitWorkspace'sdatachannel and
app.openDashboard({ dashboardId: newId, mode: 'edit' })on success,so an import lands the user on what they just imported.