Skip to content

Telemetry: Add sidebar filter telemetry for change detection#34482

Open
valentinpalkovic wants to merge 10 commits intonextfrom
worktree-snoopy-spinning-naur
Open

Telemetry: Add sidebar filter telemetry for change detection#34482
valentinpalkovic wants to merge 10 commits intonextfrom
worktree-snoopy-spinning-naur

Conversation

@valentinpalkovic
Copy link
Copy Markdown
Contributor

What I did

Added a sidebar-filter telemetry event to track usage of built-in tag filters (_docs, _play, _test) and change detection status filters (new, modified, affected) in the sidebar.

The event fires in two scenarios:

  • Interaction: when a user toggles a filter in the sidebar UI
  • URL: when a user visits Storybook with filters pre-set via URL params (shared links/bookmarks)

Each event includes the full active filter state and per-filter story counts. User-defined tag filters are explicitly excluded from telemetry.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

Caution

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

  1. Enable change detection in .storybook/main.ts: features: { changeDetection: true }
  2. Run a sandbox: yarn task --task sandbox --start-from auto --template react-vite/default-ts
  3. Open Storybook, open browser DevTools Network tab
  4. Toggle a status filter (e.g., "New") in the sidebar filter panel → verify a sidebarFilterChanged event is emitted on the channel
  5. Toggle a built-in tag filter (e.g., "Documentation") → verify telemetry event emitted
  6. Toggle a user-defined tag filter → verify NO telemetry event emitted
  7. Visit Storybook with ?statuses=status-value%3Anew URL param → verify a URL-triggered telemetry event fires once on load

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 7, 2026

View your CI Pipeline Execution ↗ for commit 9a9e290

Command Status Duration Result
nx run-many -t compile,check,knip,test,lint,fmt... ✅ Succeeded 9m 40s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-15 12:28:04 UTC

valentinpalkovic and others added 3 commits April 7, 2026 15:32
… globals exports

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
In mobile mode, clicking a story calls setMobileMenuOpen(false), which
starts a 300ms exit transition on the Modal. After it completes, children
are unmounted (unmountOnExit: true). On slow sandboxes like Angular webpack,
by the time waitForURL resolves the tree is already unmounted, so the
storyLink locator finds nothing and toHaveAttribute fails with
"element(s) not found". URL verification already confirms correct
navigation, so we safely skip the attribute check when the element is gone.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@valentinpalkovic
Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

@valentinpalkovic valentinpalkovic marked this pull request as ready for review April 15, 2026 11:59
Co-authored-by: valentinpalkovic <5889929+valentinpalkovic@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 15, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in 9a9e290 by merging latest next into this branch and resolving the conflict in code/core/src/core-server/server-channel/telemetry-channel.ts while preserving the sidebar filter telemetry handler.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants