Problem/Motivation
StorybookThemeNegotiator::applies() and storybook_file_url_alter() both check for the route name storybook.render, but the actual route defined by the module is storybook.render_story.
Because of this mismatch, the Storybook theme negotiator never applies on the real render route, and storybook_file_url_alter() never performs its intended URL rewrite there.
This can cause Storybook stories to render with the wrong theme when another theme negotiator is active, instead of using the site default theme or the theme requested via the _drupalTheme query parameter.
Steps to reproduce
- Install Storybook
1.0.3. - Enable a module/configuration that adds a non-route-restricted theme negotiator with a priority lower than
1000e.g.theme_switcher. - Load a Storybook story render URL, such as
/storybook/stories/render/{hash}. - Observe that the story may render using the theme selected by the other negotiator instead of the site default theme or the theme passed via the
_drupalThemequery parameter.
Proposed resolution
Replace storybook.render with storybook.render_story in:
src/Theme/StorybookThemeNegotiator.phpstorybook.module
Issue fork storybook-3609649
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
carolpettirossi commentedComment #4
carolpettirossi commented