Skip to content

Fix initial theme applied to stories in storybook - #182

Merged
arome merged 1 commit into
mainfrom
omar/fix-storybook-theme
Oct 22, 2025
Merged

Fix initial theme applied to stories in storybook#182
arome merged 1 commit into
mainfrom
omar/fix-storybook-theme

Conversation

@arome

@arome arome commented Oct 16, 2025

Copy link
Copy Markdown
Contributor
Before After
2025-10-16 15 29 08 2025-10-16 15 30 13

@arome
arome enabled auto-merge (squash) October 16, 2025 19:31
@arome
arome requested a review from Copilot October 17, 2025 01:49

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.

Pull Request Overview

This PR fixes the initial theme application in Storybook by replacing a custom dark mode implementation with the official storybook-dark-mode hook. The custom implementation relied on listening to channel events which didn't properly handle initial state, causing stories to render with incorrect themes on first load.

  • Replaced custom useTheme hook with useDarkMode from storybook-dark-mode package
  • Upgraded @itwin/itwinui-react to version ^3.19.4 to support the theme fix
  • Removed unused React import and channel-based event listener implementation

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
packages/apps/storybook/package.json Updated @itwin/itwinui-react dependency to ^3.19.4
packages/apps/storybook/.storybook/preview.js Replaced custom theme hook with useDarkMode from storybook-dark-mode and removed unused imports
Files not reviewed (1)
  • common/config/rush/pnpm-lock.yaml: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@arome
arome requested a review from aruniverse October 22, 2025 15:10
@arome
arome merged commit f9129e8 into main Oct 22, 2025
5 checks passed
@arome
arome deleted the omar/fix-storybook-theme branch October 22, 2025 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants