Skip to content

Maintenance: Revert pull request #33930 HMR events#34190

Merged
valentinpalkovic merged 1 commit into
nextfrom
revert/copilot/fix-storybook-hmr-events
Mar 18, 2026
Merged

Maintenance: Revert pull request #33930 HMR events#34190
valentinpalkovic merged 1 commit into
nextfrom
revert/copilot/fix-storybook-hmr-events

Conversation

@yannbf
Copy link
Copy Markdown
Member

@yannbf yannbf commented Mar 18, 2026

This reverts commit 2b6c4da, reversing changes made to 5a9c6ec.

What I did

This PR reverts the work done in #33930 until we come back to it at a later time

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

Caution

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

Release Notes

  • Refactor
    • Improved hot module replacement handling to enhance the reliability of story updates during development with more consistent update sequencing.
    • Optimized debounce behavior for story index invalidation to better handle rapid file changes.

…ook-hmr-events"

This reverts commit 2b6c4da, reversing
changes made to 5a9c6ec.
@yannbf yannbf self-assigned this Mar 18, 2026
@yannbf yannbf added maintenance User-facing maintenance tasks ci:normal labels Mar 18, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Mar 18, 2026

View your CI Pipeline Execution ↗ for commit 4c77f00

Command Status Duration Result
nx run-many -t compile -c production --parallel=1 ✅ Succeeded 5m 44s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-18 08:46:41 UTC

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8b1ed6de-4eb3-41a8-bd20-30ca3d2b85e0

📥 Commits

Reviewing files that changed from the base of the PR and between e3c5772 and 4c77f00.

📒 Files selected for processing (6)
  • code/builders/builder-vite/src/codegen-modern-iframe-script.test.ts
  • code/builders/builder-vite/src/codegen-modern-iframe-script.ts
  • code/builders/builder-vite/src/codegen-project-annotations.ts
  • code/builders/builder-webpack5/templates/virtualModuleModernEntry.js
  • code/core/src/core-server/utils/index-json.test.ts
  • code/core/src/core-server/utils/index-json.ts
💤 Files with no reviewable changes (1)
  • code/builders/builder-vite/src/codegen-project-annotations.ts

📝 Walkthrough

Walkthrough

The PR restructures HMR event emission across Vite and Webpack5 builders, moving STORY_HOT_UPDATED from module acceptance callbacks to dedicated lifecycle hooks (vite:afterUpdate for Vite, webpack hot.status idle for Webpack), and adjusts the story index debounce strategy from trailing-edge only to both leading and trailing edges.

Changes

Cohort / File(s) Summary
Vite HMR Flow
code/builders/builder-vite/src/codegen-modern-iframe-script.ts, code/builders/builder-vite/src/codegen-modern-iframe-script.test.ts, code/builders/builder-vite/src/codegen-project-annotations.ts
Restructures Vite HMR handling: moves STORY_HOT_UPDATED emission to vite:afterUpdate hook in iframe script, removes it from project annotations callback, and updates corresponding test cases to reflect the new event sequence.
Webpack5 HMR Handler
code/builders/builder-webpack5/templates/virtualModuleModernEntry.js
Adds webpack hot status handler that emits STORY_HOT_UPDATED when status becomes idle; removes STORY_HOT_UPDATED emissions from individual module accept callbacks.
Index JSON Debounce Strategy
code/core/src/core-server/utils/index-json.ts, code/core/src/core-server/utils/index-json.test.ts
Changes debounce configuration from trailing-edge only to both leading and trailing edges for STORY_INDEX_INVALIDATED emissions; removes a test case validating single-fire behavior and updates debounce documentation comments.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can validate your CodeRabbit configuration file in your editor.

If your editor has YAML language server, you can enable auto-completion and validation by adding # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json at the top of your CodeRabbit configuration file.

@valentinpalkovic valentinpalkovic merged commit 5f74cba into next Mar 18, 2026
129 of 133 checks passed
@valentinpalkovic valentinpalkovic deleted the revert/copilot/fix-storybook-hmr-events branch March 18, 2026 09:00
@github-actions github-actions Bot mentioned this pull request Mar 18, 2026
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:normal maintenance User-facing maintenance tasks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants