Skip to content

Emit per-track summary console.warn for missing dataTooltip field references #135

@dlrice

Description

@dlrice

Context
After the first render pass, a single summary console.warn lists all missing fields for that track, not per data point. src/tooltips/resolve.ts silently substitutes missing fields as empty strings (which is correct behaviour at the per-cell level), but authors get no feedback when a dataTooltip template references a field the adapter never produced. This is a common foot-gun when authoring against an unfamiliar data source: the tooltip renders blank cells and the author has no breadcrumbs to the cause.

Task
Implement a per-track missing-field accumulator in the tooltip resolver and emit one summary console.warn per track, not per data point.

Scope:

  • In src/tooltips/resolve.ts (or a helper), track the set of field paths that resolved to undefined while rendering any tooltip on a given track during a render pass.
  • After the render pass completes (or on the next animation frame — whichever is cheaper), emit a single console.warn of the form: "[protvista-uniprot] Track <categoryId>/<trackId>: dataTooltip references unknown fields: <field>, <field>, …". The warning fires once per track per render pass, not per data point.
  • Don't warn when the field resolves to a legitimate empty string / null — only when the field path doesn't exist on any of the track's data points.
  • Integrate the accumulator with both kind: fields and kind: markdown authoring forms.
  • Add a unit test in src/tooltips/__spec__/resolve.spec.ts that: (a) renders a tooltip template referencing three unknown fields across ten data points, and (b) asserts console.warn was called exactly once with all three field names.
  • Reinstate the deleted spec material in specs/config-approach.md: the Edge Cases row and the acceptance criterion.

Notes:
Keep the allocation/accounting path on the hot render path cheap — a per-track Set<string> populated during field resolution, flushed once per render pass, should be sufficient. No observable behaviour change for correctly-authored configs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    nextIssue which pertains to the next version of ProtVista.

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions