Skip to content

Review experiments + change detection#34974

Merged
yannbf merged 1 commit into
review-experimentsfrom
review-experiments-with-change-detection
May 29, 2026
Merged

Review experiments + change detection#34974
yannbf merged 1 commit into
review-experimentsfrom
review-experiments-with-change-detection

Conversation

@yannbf
Copy link
Copy Markdown
Member

@yannbf yannbf commented May 29, 2026

Closes #

What I did

For canary purposes

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>

Co-authored-by: Sidnioulz 5108577+Sidnioulz@users.noreply.github.com

Summary by CodeRabbit

  • New Features
    • Exposed experimental methods for accessing change detection service metadata, including dependency information, story file-to-ID mappings, and working directory configuration
    • Added experimental API function to retrieve the active change detection service instance during development

Review Change Stack

@yannbf yannbf self-assigned this May 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Fails
🚫

PR is not labeled with one of: ["cleanup","BREAKING CHANGE","feature request","bug","documentation","maintenance","build","dependencies"]

🚫 PR title must be in the format of "Area: Summary", With both Area and Summary starting with a capital letter Good examples: - "Docs: Describe Canvas Doc Block" - "Svelte: Support Svelte v4" Bad examples: - "add new api docs" - "fix: Svelte 4 support" - "Vue: improve docs"

Generated by 🚫 dangerJS against a8584d2

@yannbf yannbf merged commit 28f97f4 into review-experiments May 29, 2026
10 of 19 checks passed
@yannbf yannbf deleted the review-experiments-with-change-detection branch May 29, 2026 13:35
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Adds an in-process active-service registry to track the Storybook dev server's single ChangeDetectionService instance, exposes three new public getter methods (getReverseIndex, getStoryIdsByFile, getWorkingDir), registers the service during dev-server initialization, and re-exports registry functions through the public API to enable addon presets to access the service.

Changes

Active Change-Detection Service Registry

Layer / File(s) Summary
Active-service registry module
code/core/src/core-server/change-detection/active-service-registry.ts
Introduces module-scoped activeService variable with exported setActiveChangeDetectionService() and getActiveChangeDetectionService() functions to manage the currently active service instance.
ChangeDetectionService public accessors and lifecycle
code/core/src/core-server/change-detection/ChangeDetectionService.ts
Adds import for setActiveChangeDetectionService, three new public getter methods (getReverseIndex(), getStoryIdsByFile(), getWorkingDir()), and updates dispose() to clear the active service registry.
Dev-server service registration
code/core/src/core-server/dev-server.ts
Updates change-detection module import and registers the constructed ChangeDetectionService instance as the active in-process service after instantiation.
Public API re-exports
code/core/src/core-server/change-detection/index.ts, code/core/src/core-server/index.ts
Re-exports getActiveChangeDetectionService and setActiveChangeDetectionService from active-service-registry through change-detection/index.ts, and exposes the getter as experimental_getActiveChangeDetectionService in core-server/index.ts.

Sequence Diagram

sequenceDiagram
  participant DevServer
  participant ChangeDetectionService
  participant Registry as active-service-registry
  participant Consumer as Addon Preset Consumer
  DevServer->>ChangeDetectionService: new ChangeDetectionService()
  DevServer->>Registry: setActiveChangeDetectionService(service)
  Registry->>Registry: store activeService reference
  Consumer->>Registry: getActiveChangeDetectionService()
  Registry-->>Consumer: return activeService
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • storybookjs/storybook#34369: Introduces foundational ChangeDetectionService changes that this PR's active-service registry and public accessors build upon.
  • storybookjs/storybook#34498: Modifies the same dev-server initialization flow for ChangeDetectionService startup timing, creating a direct dependency with the service registration wiring added here.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant