chore: performance storybook addon for 2nd gen#6042
Conversation
|
📚 Branch Preview Links🔍 First Generation Visual Regression Test ResultsWhen 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: If the changes are expected, update the |
|
Ongoing discussions with upstream team to scaffold this architecture into a universal endpoint to support web-components: github/storybook-addon-performance-panel#41 |
… router for this addon
…com/adobe/spectrum-web-components into rajdeep/performance-storybook-addon
Description
@github-ui/storybook-addon-performance-panelinto the 2nd-gen Storybook instance, adding a Performance panel to the dev tools for real-time runtime metrics while developing components.withPerformanceMonitordecorator 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:
PerformanceObserver(longtask)PerformanceObserver(layout-shift)PerformanceObserver(event timing)performance.memoryMutationObserverMotivation and context
Related issue(s)
Screenshots (if appropriate)
Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
Descriptive Test Statement
Descriptive Test Statement
Device review
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.
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.