Skip to content

feat(builder-rsbuild): support Storybook change detection#458

Draft
fi3ework wants to merge 3 commits intomainfrom
feat/storybook-change-detection
Draft

feat(builder-rsbuild): support Storybook change detection#458
fi3ework wants to merge 3 commits intomainfrom
feat/storybook-change-detection

Conversation

@fi3ework
Copy link
Copy Markdown
Member

Summary

This adds Storybook changeDetection support to storybook-builder-rsbuild without requiring any new Rspack API.

What changed

  • add onModuleGraphChange(cb) support to the builder
  • convert Rspack Compilation.moduleGraph into Storybook's builder-agnostic ModuleGraph
  • emit graph updates from onDevCompileDone for initial compile and rebuilds
  • exclude story modules from lazyCompilation when features.changeDetection is enabled by composing lazyCompilation.test
  • add regression tests for graph construction, listener lifecycle, multistats merge, and lazyCompilation matching

Validation

  • pnpm exec rstest 'packages/builder-rsbuild/tests/build-module-graph.test.ts' 'packages/builder-rsbuild/tests/index.test.ts' 'packages/builder-rsbuild/tests/preview/iframe-rsbuild.config.test.ts'
  • manual canary validation against storybook@0.0.0-pr-34370-sha-b4eae34c
    • modify and remove-from-graph scenarios produced modified/affected statuses in the Storybook UI
    • direct file deletion that causes compile failure does not continue to update statuses, which matches the current canary behavior

Notes

  • root pnpm.overrides and the sandboxes/react-18 features.changeDetection flag are intentionally included on this preview branch to keep canary validation reproducible while debugging with Storybook maintainers
  • these temporary canary/debugging changes should be cleaned up before merging to main

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71e01117a2

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@fi3ework fi3ework marked this pull request as draft April 1, 2026 03:41
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.

1 participant