Skip to content

Dashboard tile ignores saved view: "table" and auto-renders a chart #368

Description

@BorisTyshkevich

Summary

A saved query explicitly configured with:

{
  "name": "query_log",
  "favorite": true,
  "view": "table"
}

renders as an automatically selected chart when opened as a Dashboard tile.

The saved view: "table" choice must take precedence over automatic panel detection. autoPanel() should only run when no explicit presentation has been saved.

Found during manual testing on github.demo, build v0.6.1 (3415404).

Reproduction

  1. Create a query whose result is chartable.
  2. Select the Table result view.
  3. Save the query.
  4. Star it to add it to the Dashboard.
  5. Open the Dashboard.

Actual result

The tile renders an automatically selected line, area, bar, KPI, or Logs presentation depending on the result shape.

For the reported query, it rendered a line chart with a duplicate-X aggregation note.

Expected result

The tile renders a plain Table grid because the saved query explicitly contains:

{
  "view": "table"
}

Root cause

The Dashboard presentation resolver only reads spec.panel:

const spec = isObject(query) ? query.spec : undefined;
const basePanel =
  isObject(spec) && isObject(spec.panel)
    ? cloneJson(spec.panel)
    : {};

When the query has view: "table" but no panel.cfg, the resolver produces an empty panel object and discards the saved Table choice.

The empty object later reaches resolvePanel(). Because no explicit cfg exists, resolvePanel() calls autoPanel().

autoPanel() is working as designed for an unconfigured query: it attempts Logs, KPI, or a chart before using Table as the final fallback. The defect is that the explicit view: "table" signal was lost before automatic detection ran.

queryDashboardRole() defaulting an undeclared role to panel is expected behavior and is not part of this bug.

Required precedence

Dashboard presentation selection should follow:

Explicit panel configuration
    >
Explicit saved view: "table"
    >
Automatic panel detection

Automatic detection must not override an explicit Table selection.

Fix direction

Handle the compatibility form in the shared resolvePresentation() path.

When:

  • spec.panel?.cfg is absent; and
  • spec.view === "table"

use a Table base presentation equivalent to:

{
  "cfg": {
    "type": "table"
  }
}

Conceptually:

const basePanel =
  isObject(spec) && isObject(spec.panel)
    ? cloneJson(spec.panel)
    : isObject(spec) && spec.view === 'table'
      ? { cfg: { type: 'table' } }
      : {};

Explicit panel.cfg remains authoritative. Queries with neither an explicit panel nor an explicit Table view continue through autoPanel().

The fix belongs in the shared presentation resolver so Workbench preview, Dashboard viewing, import validation, variants, overrides, and future callers use the same base-presentation semantics.

Acceptance criteria

  • A chartable query with view: "table" and no panel.cfg renders as a Table Dashboard tile.
  • A log-shaped query with view: "table" renders as a plain Table, not Logs.
  • A single-row query with view: "table" renders as a Table, not KPI.
  • An explicit panel.cfg remains authoritative regardless of spec.view.
  • A query with no explicit panel presentation continues to use autoPanel().
  • Named variants and tile-local overrides continue to resolve over the effective base presentation.
  • Regression coverage is added to the presentation resolver and Dashboard rendering tests.

Attribution

The behavior predates the current filter work and is not caused by #364.

The Dashboard presentation resolver was introduced as part of the first-class Dashboard work. The underlying automatic-panel behavior is older and remains valid for genuinely unconfigured queries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginboxFiled mid-task; not yet triaged into the roadmap

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions