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

  1. Install Storybook 1.0.3.
  2. Enable a module/configuration that adds a non-route-restricted theme negotiator with a priority lower than 1000 e.g. theme_switcher.
  3. Load a Storybook story render URL, such as /storybook/stories/render/{hash}.
  4. 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 _drupalTheme query parameter.

Proposed resolution

Replace storybook.render with storybook.render_story in:

  • src/Theme/StorybookThemeNegotiator.php
  • storybook.module

Issue fork storybook-3609649

Command icon 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

carolpettirossi created an issue. See original summary.

carolpettirossi’s picture

Issue summary: View changes
carolpettirossi’s picture

Issue summary: View changes