Skip to content

Make report panel auto-refresh with latest scan results #18

Description

@dollfins

Description

The report panel (reportPanel.ts) is a static snapshot. Once opened, it does not update when new scan results arrive. Users must close and re-open the panel to see fresh results. The status bar shows the latest score, but the report panel falls out of sync.

Current Behavior

  • showReportPanel() creates a new webview each time
  • The caller passes diagnosticsProvider.lastReport which is a snapshot
  • No mechanism exists to push updates to an already-open panel

Expected Behavior

Option A: Auto-refresh open panel

  • Track if a report panel is currently open
  • When new scan results arrive, post a message to the webview with updated data
  • The webview re-renders findings and score in-place

Option B: Reveal existing panel

  • Before creating a new panel, check if one already exists
  • If it does, reveal it (bring to front) instead of creating a duplicate
  • Optionally refresh its content

Recommended: Both

  • Reuse the existing panel if one is open
  • Auto-refresh content when new scan results are available
  • Use panel.webview.postMessage({ type: 'update', results }) to push updates

Implementation Notes

  • Store the active panel reference in a module-level variable
  • Register a postMessage handler in the webview JS
  • In diagnostics.ts, after scan completes, call a updateReport() function
  • Handle the case where the panel has been closed by the user (dispose event)

Acceptance Criteria

  • Report panel is reused (not duplicated) when reopened
  • Panel content refreshes automatically after a new scan
  • Closing and reopening the panel works correctly
  • The panel title shows the scan timestamp or score
  • No memory leaks (panel disposal is handled)

Complexity

Medium — requires webview lifecycle management and cross-module communication.

Points

150

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions