Storybook: Scope Docs theme providers#79496
Conversation
|
Size Change: 0 B Total Size: 7.5 MB |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Flaky tests detected in f60863f. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/28241948094
|
|
|
||
| type DesignSystemThemeGlobals = StoryContext[ 'globals' ]; | ||
|
|
||
| function getDesignSystemThemeSettings( globals: DesignSystemThemeGlobals ) { |
There was a problem hiding this comment.
I like the refactor, but do I understand correctly that it's unrelated to the fix in question?
There was a problem hiding this comment.
Not sure we need the tests, it's a good amount of overhead for a noncritical one-liner fix, and it's quite easy to notice any regressions in our daily exposure to the Storybook.
6759c87 to
f60863f
Compare
|
@mirka less is more. PR is down to a single line diff :) |
* Storybook: Scope Docs theme providers * Storybook: Simplify Docs theme provider fix * Storybook: Remove Docs theme test refactor --- Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: mirka <0mirka00@git.wordpress.org>
What?
Fixes a dev-mode Storybook warning on Docs pages:
Storybook now keeps the Design System theme decorator as a root provider in Canvas mode, but scopes it in Docs mode.
Why?
The Design System theme decorator applied
isRootto every matching story. Canvas pages render one story in the preview iframe, so there was only one root provider. Docs pages also run inside the preview iframe, but theirPrimaryandStoriesblocks render multiple stories into that same iframe document rather than separate iframe documents. Each decorated story therefore mounted a competing root provider against the samedocument.documentElement.How?
Sets
isRootonly when the decorated story is not rendered in Docs mode.Testing Instructions
npm run lint:js -- storybook/decorators/with-design-system-theme.tsx.Components/ButtonDocs and confirm the browser console does not show the duplicate root-providerThemeProviderwarning.Components/ButtonDefault story and confirm the warning is still absent.Testing Instructions for Keyboard
Not applicable; this changes Storybook theme-provider wiring and does not change keyboard interaction.
Screenshots or screencast
Not applicable.
Use of AI Tools
This PR was investigated and drafted with Codex.