Skip to content

fix(storybook): use a single React instance for Rspress stories - #134

Merged
chenjiahan merged 1 commit into
mainfrom
fix-chromatic-react-singleton
Oct 28, 2026
Merged

chenjiahan merged 1 commit into
mainfrom
fix-chromatic-react-singleton

Conversation

@SoonIter

@SoonIter SoonIter commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Motivation

Chromatic fails to capture the English and Chinese BlogAuthors stories with Cannot read properties of null (reading 'useContext') (failed run). Rspress resolves React 19.3.0 while the Storybook renderer uses React 19.3.1, so its hooks run against a different React instance.

Changes

Alias react and react-dom, including their subpaths, to the project's installed packages in Storybook so Rspress and the renderer share one instance.

Validation: reproduced the production Storybook error before the fix; all 20 existing stories render after the fix, including both BlogAuthors stories. Library build, Storybook build, existing test, and lint/format checks for .storybook/main.ts pass.

Before After
BlogAuthors render error BlogAuthors renders correctly

Copilot AI balanced review requested due to automatic review settings October 28, 2026 09:59
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T10:00:12.795306Z d30cadf PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@chenjiahan
chenjiahan merged commit 9c96ca4 into main Oct 28, 2026
6 checks passed
@chenjiahan
chenjiahan deleted the fix-chromatic-react-singleton branch October 28, 2026 10:29
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