Skip to content

Dashboard tile removal skips renderer cleanup (chart instances / image object URLs leak) #318

Description

@BorisTyshkevich

What

Removing a Dashboard tile (the remove-tile command / a grid-membership change) never invokes the tile's renderer cleanup: src/ui/dashboard.ts simply drops the tileEls entry without calling destroyChart(tileEl), so the panel arm's destroy slot (Chart.js instance teardown — and, since #307, an image tile's revokeObjectUrl) is skipped for the removed tile.

Found during #307's review (src/ui/dashboard.ts, tile reconcile/removal paths for both flow@1 and grafana-grid@1; destroyChart is only called on repaint/state transitions of tiles that still exist).

Why deferred

Pre-existing behavior that affects chart instances too, not something #307 introduced — the image panel deliberately follows the same established destroy-slot convention rather than inventing new tile-lifecycle infrastructure inside a feature PR. Impact is a bounded leak (one Chart.js instance / one blob URL per removed tile, page-lifetime), only reachable through edit-mode tile removal.

Fix sketch

On tile removal in the reconcile paths, call destroyChart(tileEl) (which already funnels both chart and image cleanup) before dropping the tileEls entry, in both layout engines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    inboxFiled 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