Skip to content

PseudoStates: Preserve URL globals on story change - #35211

Merged
Sidnioulz merged 2 commits into
nextfrom
sidnioulz/issue-32221
Jun 22, 2026
Merged

Sidnioulz merged 2 commits into
nextfrom
sidnioulz/issue-32221

Conversation

@Sidnioulz

@Sidnioulz Sidnioulz commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #32221

What I did

The decorator's parameter->globals sync effect was emitting UPDATE_GLOBALS
with an empty config on every story that didn't declare 'parameters.pseudo'.
On initial load, this overwrote pseudo state globals supplied via URL or
toolbar (e.g. ?globals=pseudo.focusVisible:!true) with {}, dropping the
user's selection before it could be applied.

Skip the sync when the parameter has no pseudo states to push, so URL and
toolbar globals survive on stories that don't set the parameter themselves.

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

  • Navigate to SB instance
  • Open a story without a pseudostates param, e.g. Components / Select / *
  • Set a pseudo state
  • Navigate to the next story
  • Notice it persists
  • Unset it
  • Navigate to the next story
  • Notice it stays unset

🦋 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>

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed an issue where pseudo-state styling could be unintentionally cleared when navigating between stories that don't define pseudo-states, ensuring toolbar selections persist correctly.
  • Tests

    • Added end-to-end regression test to verify pseudo-state decorators persist across unrelated story navigation.

…rameter

The decorator's parameter->globals sync effect was emitting UPDATE_GLOBALS
with an empty config on every story that didn't declare 'parameters.pseudo'.
On initial load, this overwrote pseudo state globals supplied via URL or
toolbar (e.g. ?globals=pseudo.focusVisible:!true) with {}, dropping the
user's selection before it could be applied.

Skip the sync when the parameter has no pseudo states to push, so URL and
toolbar globals survive on stories that don't set the parameter themselves.

Fixes #32221
@Sidnioulz Sidnioulz self-assigned this Jun 18, 2026
Copilot AI review requested due to automatic review settings June 18, 2026 13:15

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Sidnioulz Sidnioulz added bug ui ci:normal Run our default set of CI jobs (choose this for most PRs). addon: pseudo-states qa:skip Pull Requests that do not need any QA. (e.g. documentation) labels Jun 18, 2026
@Sidnioulz Sidnioulz moved this to In Progress in Core Team Projects Jun 18, 2026
@Sidnioulz
Sidnioulz requested a review from a team June 18, 2026 15:48
This was referenced Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

addon: pseudo-states bug ci:normal Run our default set of CI jobs (choose this for most PRs). qa:skip Pull Requests that do not need any QA. (e.g. documentation) ui

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug]: Pseudostate addon URL parameters get reset on load

3 participants