Skip to content

chore: performance storybook addon for 2nd gen#6042

Draft
Rajdeepc wants to merge 9 commits intomainfrom
rajdeep/performance-storybook-addon
Draft

chore: performance storybook addon for 2nd gen#6042
Rajdeepc wants to merge 9 commits intomainfrom
rajdeep/performance-storybook-addon

Conversation

@Rajdeepc
Copy link
Contributor

@Rajdeepc Rajdeepc commented Feb 21, 2026

Description

  • Integrates GitHub's newly open-sourced @github-ui/storybook-addon-performance-panel into the 2nd-gen Storybook instance, adding a Performance panel to the dev tools for real-time runtime metrics while developing components.
  • Adds a custom withPerformanceMonitor decorator that bridges the addon (designed for React) with our web components framework by collecting metrics via native web platform APIs (requestAnimationFrame, PerformanceObserver, MutationObserver) and emitting them to the addon's manager panel through the Storybook channel.

Why a custom decorator?

The addon ships a React-specific preview decorator that uses React Profiler to collect metrics. Since our stories render web components (not React), loading the default decorator causes rendering errors. We load only the addon's manager panel via the /preset entry point and provide our own decorator that collects equivalent metrics using browser-native APIs:

  • Frame timing: FPS, frame time, dropped frames, frame stability via requestAnimationFrame
  • Long tasks & TBT: via PerformanceObserver (longtask)
  • Layout shifts (CLS): via PerformanceObserver (layout-shift)
  • Input latency & INP: via PerformanceObserver (event timing)
  • Long animation frames (LoAF): via PerformanceObserver (long-animation-frame)
  • Memory usage: via performance.memory
  • DOM element count: via MutationObserver

Motivation and context

Related issue(s)

Screenshots (if appropriate)


Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published.
  • I have included updated documentation if my change required it.

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • Automated tests cover all use cases and follow best practices for writing
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Manual review test cases

  • Descriptive Test Statement

    • Start 2nd-gen Storybook (cd 2nd-gen/packages/swc && yarn storybook)
    • Navigate to any component story
    • Open the Performance panel in the bottom addon tabs
    • Verify metrics are actively being collected (FPS, frame time, memory, etc.)
    • Interact with a component and verify input latency metrics update
    • Switch between stories and verify metrics reset correctly
    • Confirm no rendering errors or console warnings from the addon
  • Descriptive Test Statement

    1. Go here
    2. Do this action
    3. Expect this result

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

Accessibility testing checklist

Required: Complete each applicable item and document your testing steps (replace the placeholders with your component-specific instructions).

  • Keyboard (required — document steps below) — What to test for: Focus order is logical; Tab reaches the component and all interactive descendants; Enter/Space activate where appropriate; arrow keys work for tabs, menus, sliders, etc.; no focus traps; Escape dismisses when applicable; focus indicator is visible.

    1. Go here
    2. Do this action
    3. Expect this result
  • Screen reader (required — document steps below) — What to test for: Role and name are announced correctly; state changes (e.g. expanded, selected) are announced; labels and relationships are clear; no unnecessary or duplicate announcements.

    1. Go here
    2. Do this action
    3. Expect this result

@Rajdeepc Rajdeepc requested a review from a team as a code owner February 21, 2026 06:36
@changeset-bot
Copy link

changeset-bot bot commented Feb 21, 2026

⚠️ No Changeset found

Latest commit: ca5d73c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Rajdeepc Rajdeepc marked this pull request as draft February 21, 2026 06:36
@github-actions
Copy link
Contributor

github-actions bot commented Feb 21, 2026

📚 Branch Preview Links

🔍 First Generation Visual Regression Test Results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Deployed to Azure Blob Storage: pr-6042

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

@Rajdeepc Rajdeepc changed the title Rajdeep/performance storybook addon chore: performance storybook addon for 2nd gen Feb 21, 2026
@Rajdeepc Rajdeepc self-assigned this Feb 21, 2026
@Rajdeepc Rajdeepc added the Component:Tooling Issue or PR dealing with scripts, workflows, automation, etc. Component prefix is for Jira label Feb 21, 2026
@Rajdeepc
Copy link
Contributor Author

Rajdeepc commented Feb 23, 2026

Ongoing discussions with upstream team to scaffold this architecture into a universal endpoint to support web-components: github/storybook-addon-performance-panel#41

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

Labels

Component:Tooling Issue or PR dealing with scripts, workflows, automation, etc. Component prefix is for Jira

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant