Skip to content

Importing a Dashboard bounces the user back to the Query surface #454

Description

@BorisTyshkevich

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions