Skip to content

Core: Fetch static open-service snapshots relative to the document - #35945

Merged
valentinpalkovic merged 2 commits into
nextfrom
valentin/static-services-subpath-fetch
Aug 18, 2026
Merged

valentinpalkovic merged 2 commits into
nextfrom
valentin/static-services-subpath-fetch

Conversation

@valentinpalkovic

Copy link
Copy Markdown
Contributor

What I did

Static open-service snapshots were fetched from /services/<path>, an origin-absolute URL.
A Storybook served below the origin root - a GitHub Pages project site, a docs site mounted under a path - therefore asked for its snapshots at a location belonging to a different site, and every static open-service load 404'd.

Every other build artifact is already document-relative. STORY_INDEX_PATH is ./index.json, in both the preview and the manager. This aligns the services prefix with that.

Deployed at  https://acme.github.io/design-system/

  index.json      ./index.json      -> /design-system/index.json      200
  snapshots       /services/…       -> /services/…                    404   <- before
  snapshots       ./services/…      -> /design-system/services/…      200   <- after

The same defect in the preview navigator's index fetch is fixed alongside it, since it is the identical one-line mistake.

The failure, captured

A real storybook build served under /storybook/, before the fix. The Open Service static-load story renders its query results:

Entry alpha Entry beta
before null null
after "static-load:alpha" "static-load:beta"

Network for that page, before:

GET http://localhost:8099/services/storybook/internal/open-service-static-load-demo/alpha.json   404
GET http://localhost:8099/services/storybook/internal/open-service-static-load-demo/beta.json    404

After:

GET http://localhost:8099/storybook/services/storybook/internal/open-service-static-load-demo/alpha.json   200
GET http://localhost:8099/storybook/services/storybook/internal/open-service-static-load-demo/beta.json    200
GET http://localhost:8099/storybook/services/core/docgen/core-shared-open-service-sync-test-static-load.json      200
GET http://localhost:8099/storybook/services/core/story-docs/core-shared-open-service-sync-test-static-load.json  200

The user-facing consequence is wider than the demo story: with experimentalDocgenServer on, core/story-docs is what fills the Code panel and autodocs source blocks, so on a sub-path deploy those went blank.
@storybook/angular-vite turns that flag on from its own preset, so the regression shipped there by default.

The change

-const STATIC_SERVICES_PREFIX = '/services/';
+const STATIC_SERVICES_PREFIX = './services/';

Relative resolution is what makes the manager and the preview agree: index.html and iframe.html are siblings in the build output, so ./services/… resolves to the same place from either document. That is the property the old comment claimed the absolute path was needed for.

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

code/core/src/shared/open-service/static-fetch.test.ts gains a case asserting the request resolves under the deployment directory from both the manager document URL and the preview iframe document URL. The existing cases that pinned the absolute URL are updated.

Not covered by an e2e: the existing static-build specs serve Storybook at the origin root, so none of them can observe this. Adding a sub-path variant means teaching the e2e harness to serve under a prefix, which is more than this fix should carry.

Manual testing

Requires a build made with the docgen server on, since that is what populates services/.

  1. cd code && STORYBOOK_EXPERIMENTAL_DOCGEN_SERVER=true yarn storybook:ui:build
  2. Stage it under a sub-path, so the layout matches a GitHub Pages project site:
    mkdir -p /tmp/sb-site/storybook
    cp -r code/storybook-static/. /tmp/sb-site/storybook/
  3. cd /tmp/sb-site && python3 -m http.server 8101
    (Use python3 -m http.server, not npx serve - the latter strips .html by default and 301s iframe.html, which breaks the preview for unrelated reasons.)
  4. Open http://localhost:8101/storybook/?path=/story/core-shared-open-service-sync-test-static-load--static-load-sync
  5. Entry alpha and Entry beta should read "static-load:alpha" and "static-load:beta". On next they read null.
  6. Open http://localhost:8101/storybook/?path=/story/addons-docs-codepanel--default and select the Code tab. The snippet should render. On next the panel stays empty.
  7. In devtools, every services/… request should be under /storybook/services/… and return 200.

Documentation

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

No documentation change: this restores the behavior the docs already describe. docs/sharing/publish-storybook.mdx lists GitHub Pages as a supported target.

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

  • Declare whether manual QA will be needed for this PR during the next release, through qa:needed or qa:skip

  • 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.

`createBrowserStaticLoader` requested `/services/<path>`, resolved against
the origin root rather than the deployed directory. A Storybook served
below the root - a GitHub Pages project site, a docs site mounted under a
path - therefore fetched its snapshots from a location that belongs to a
different site, and every open-service static load 404'd.

Every other build artifact is already document-relative: `STORY_INDEX_PATH`
is `./index.json` in both the preview and the manager. This aligns the
services prefix with that, and fixes the same defect in the preview
navigator's index fetch.
@coderabbitai

coderabbitai Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 17 minutes

Limit details: You’ve used all 1 included review currently available under your plan. You completed 60 included PR reviews in the past 7 days; at that activity level, included reviews refill at 1 review per hour.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bc7469fc-044e-4d11-aa0a-eae860bf36f6

📥 Commits

Reviewing files that changed from the base of the PR and between 93262de and 4c7d9ae.

📒 Files selected for processing (3)
  • code/core/src/preview/preview-navigator.ts
  • code/core/src/shared/open-service/static-fetch.test.ts
  • code/core/src/shared/open-service/static-fetch.ts

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

Comment thread code/core/src/shared/open-service/static-fetch.ts Outdated
@valentinpalkovic valentinpalkovic added ci:normal Run our default set of CI jobs (choose this for most PRs). qa:skip Pull Requests that do not need any QA. (e.g. documentation) labels Aug 18, 2026
@storybook-app-bot

Copy link
Copy Markdown
Contributor

Package Benchmarks

Commit: 4c7d9ae, ran on 18 August 2026 at 13:29:55 UTC

The following packages have significant changes to their size or dependencies:

@storybook/angular-vite

Before After Difference
Dependency count 20 20 0
Self size 23.13 MB 23.11 MB 🎉 -20 KB 🎉
Dependency size 11.49 MB 11.49 MB 0 B
Bundle Size Analyzer Link Link

@valentinpalkovic
valentinpalkovic merged commit a6714df into next Aug 18, 2026
155 of 158 checks passed
@valentinpalkovic
valentinpalkovic deleted the valentin/static-services-subpath-fetch branch August 18, 2026 13:34
@github-actions github-actions Bot mentioned this pull request Aug 18, 2026
3 tasks done
@ndelangen ndelangen added the patch:yes Bugfix & documentation PR that need to be picked to main branch label Aug 20, 2026
@github-actions github-actions Bot mentioned this pull request Aug 20, 2026
5 tasks done
@github-actions github-actions Bot added the patch:done Patch/release PRs already cherry-picked to main/release branch label Aug 20, 2026
hasanshahriar32 pushed a commit to Paradox-Tech-BD/nirog-storybook that referenced this pull request Aug 22, 2026
…-services-subpath-fetch

Core: Fetch static open-service snapshots relative to the document
(cherry picked from commit a6714df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug ci:normal Run our default set of CI jobs (choose this for most PRs). patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch qa:skip Pull Requests that do not need any QA. (e.g. documentation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants