Repository navigation
Why in version 10.5.10 global pseudo states preserve on story change #36031
SummaryIn version 10.4.3 when I change story, global URL pseudo states parameters was empty if it is not sets. Now in version 10.5.10 when i change Story, I see the same pseudo parametero on this Story too, for me it is unexpected behaviour. I have researched the issue with merged PR - https://github.com/MichaelDeBoey/storybook/commit/b505685d0b92fafd5d572d7754925f7f59db13b9 So which behaviour is expected? How can I clean all pseudo states if it is not sets in Story now? Additional informationNo response Create a reproductionNo response |
Replies: 1 comment 2 replies
|
The 10.5.10 behavior is the intended one — what changed is that a long-standing accident was fixed. In 10.4.x, the pseudo-states decorator emitted Since toolbar/URL pseudo states are Storybook globals, they now behave like other globals (backgrounds, viewport): they're session-wide and persist across stories until you change them. To clear them:
If your workflow really depends on the old auto-reset-per-story behavior, that's worth raising as a feature request (e.g. an addon option), but the previous resetting was a side effect of the bug rather than a designed feature. |
Good question — and no: an empty
parameters.pseudo: {}will not clear it. The sync effect explicitly skips empty configs (theObject.keys(config).length > 0guard in withPseudoState.ts) — pushing empty configs into globals on every story is precisely what used to wipe URL/toolbar state before the fix.Programmatically: the pseudo state lives in the
pseudoglobal, so anything that emitsUPDATE_GLOBALScan clear it. If you want "reset on every story unless the story declares its own", this in.storybook/preview.tsshould do it (untested sketch, but it follows the addon's own mechanism):