Skip to content

Pause browser collectors while the panel is hidden - #159

Merged
mattcosta7 merged 1 commit into
v1.2/03-visible-panel-updatesfrom
v1.2/04-collection-modes
Aug 3, 2026
Merged

Pause browser collectors while the panel is hidden#159
mattcosta7 merged 1 commit into
v1.2/03-visible-panel-updatesfrom
v1.2/04-collection-modes

Conversation

@mattcosta7

@mattcosta7 mattcosta7 commented Aug 3, 2026

Copy link
Copy Markdown
Member

Summary

Reduce addon background overhead without adding a public collection-mode API.

  • start browser collectors, DOM observation, and live-update timers when the Performance panel becomes visible
  • stop that work when the panel is hidden while preserving metrics already gathered for the story
  • keep React Profiler callbacks attached so mount and render history is not lost before the panel opens
  • resume collection automatically when the panel reopens
  • document the automatic collection lifecycle

Stack

Validation

  • 60 test files / 837 tests across Chromium, Firefox, WebKit, and Node
  • npm run tsc
  • npm run build
  • publint and Are The Types Wrong: no issues
  • npm run lint -- --no-cache (one pre-existing unused suppression warning)

Copilot AI review requested due to automatic review settings August 3, 2026 00:26
@mattcosta7
mattcosta7 requested a review from a team as a code owner August 3, 2026 00:26
@mattcosta7
mattcosta7 temporarily deployed to github-pages-preview August 3, 2026 00:27 — with GitHub Actions Inactive

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds low-overhead core collection while retaining deeper instrumentation through opt-in diagnostic mode.

Changes:

  • Adds collection-mode configuration and mode-aware collector lifecycle.
  • Disables higher-overhead pointer, style, reflow, and compositor instrumentation in core mode.
  • Hides most diagnostic metrics and documents mode selection.
Show a summary per file
File Description
.changeset/collection-modes.md Records the patch release.
README.md Documents collection modes.
performance-panel.tsx Conditionally displays diagnostic metrics.
decorators/universal.ts Selects mode and recreates cores.
core/preview-core.ts Propagates collection mode.
core/performance-types.ts Defines mode types and parameters.
collectors/collector-manager.ts Selects collectors by mode.
collectors/input-collector.ts Makes pointer sampling optional.
collectors/paint-collector.ts Makes layer scanning optional.
collectors/__tests__/collector-manager.browser.test.ts Tests mode-specific orchestration.
collectors/__tests__/input-collector.browser.test.ts Tests disabled pointer tracking.
collectors/__tests__/paint-collector.browser.test.ts Tests disabled layer scanning.
__tests__/performance-decorator-universal.browser.test.ts Tests defaults and mode changes.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 13/13 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread packages/storybook-addon-performance-panel/performance-panel.tsx Outdated
@mattcosta7
mattcosta7 marked this pull request as draft August 3, 2026 00:31
@mattcosta7
mattcosta7 force-pushed the v1.2/03-visible-panel-updates branch from de57742 to dfd8d67 Compare August 3, 2026 02:17
@mattcosta7
mattcosta7 force-pushed the v1.2/04-collection-modes branch from 562a9b8 to 2152cba Compare August 3, 2026 02:22
@mattcosta7
mattcosta7 temporarily deployed to github-pages-preview August 3, 2026 02:22 — with GitHub Actions Inactive
@mattcosta7
mattcosta7 force-pushed the v1.2/04-collection-modes branch from 2152cba to ece99ce Compare August 3, 2026 04:24
@mattcosta7
mattcosta7 force-pushed the v1.2/03-visible-panel-updates branch from dfd8d67 to 119dbc4 Compare August 3, 2026 04:24
@mattcosta7 mattcosta7 changed the title Add a low-overhead default collection mode Pause browser collectors while the panel is hidden Aug 3, 2026
@mattcosta7
mattcosta7 merged commit ece99ce into v1.2/03-visible-panel-updates Aug 3, 2026
8 of 15 checks passed
@mattcosta7
mattcosta7 deleted the v1.2/04-collection-modes branch August 3, 2026 12:10

Copy link
Copy Markdown
Member Author

Folded into #158 so the visibility protocol and the lifecycle it controls can be reviewed and released together. #158 now includes this PR’s browser collector, DOM observation, documentation, and test changes, plus the consolidated minor changeset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants