Skip to content

[SB-2009] Postpone Story Store access removal; keep the global emitted - #36739

Closed
obvious-autobuild[bot] wants to merge 3 commits into
nextfrom
feat/sb-2009-remove-story-store-access
Closed

obvious-autobuild[bot] wants to merge 3 commits into
nextfrom
feat/sb-2009-remove-story-store-access

Conversation

@obvious-autobuild

@obvious-autobuild obvious-autobuild Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What changed

The removal of the two deprecated direct Story Store access paths — the window.__STORYBOOK_STORY_STORE__ global and the preview.storyStore getter — is postponed past 11.0.

Chromatic's capture and extract clients read the global in production (render selection, play-function checks, JS-loaded detection, story extraction), and Chromatic is not being asked to change its client for this release. Merging the removal would break captures of 11.0+ builds: on the earlier revision of this PR, all 15 Chromatic template checks failed at story extraction for exactly that reason.

Decision 2026-10-13 (Norbert): keep the global emitted, postpone the removal.

What this PR does now

  • Both builders keep emitting window.__STORYBOOK_STORY_STORE__ and its type declarations stay — capture and extract behavior is unchanged from next.
  • The deprecated paths stay deprecated: the migration guide's 11.0 section now records the postponement and points at the supported Preview APIs (ready(), loadStory(), getStoryContext(), extract()).
  • The monorepo's dev Storybook docs loader migrates to the new supported Preview.createDocsContext(importPaths) factory, so the last in-repo use of the deprecated access paths is gone and the store instance never leaves the preview.
  • Does not close SB-2009 — the removal itself moves to a later major.

Refs SB-2009

🔗 Obvious Project · 🧵 Obvious Thread · 🔀 Obvious PR Artifact

The preview.storyStore proxy getter, the window.__STORYBOOK_STORY_STORE__
global emitted by the vite and webpack5 builders, and the ambient type
declarations for that global are removed, along with
StoryStoreAccessedBeforeInitializationError, whose only throw site was
the getter. The deprecation notices promised removal in 9.0; the
codebase is developing 11.0.

Integrators reading the store should use the supported Preview API:
await preview.ready(), preview.loadStory({ storyId }),
preview.getStoryContext(), and preview.extract(). Integrators who
construct a DocsContext outside core can call the new
preview.createDocsContext(importPaths), which resolves the paths
against the story index, loads the CSF files, and constructs the
context with the internal store. The store instance never leaves the
preview.

The dev Storybook's docs loader migrates to the factory, so no
first-party code outside Preview reaches the store.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@obvious-autobuild obvious-autobuild Bot added the ci:normal Run our default set of CI jobs (choose this for most PRs). label Oct 12, 2026
@obvious-autobuild obvious-autobuild Bot changed the title [SB-2009] Remove deprecated direct Story Store access SB-2009: Remove deprecated direct Story Store access Oct 12, 2026
@obvious-autobuild obvious-autobuild Bot added the qa:needed Pull Requests that will need manual QA prior to release. label Oct 12, 2026
@obvious-autobuild

Copy link
Copy Markdown
Contributor Author

About the red ci/circleci: *--chromatic checks — these fail inside Chromatic's own verification step, not in the builds themselves. Details if you're reviewing:

What the logs show (all 15 templates, identical): the sandbox builds and uploads succeed, then Chromatic's "Verifying your Storybook" step fails with Failed to extract stories from your Storybook / Error: JavaScript failed to load (exit 23, despite --exit-zero-on-changes). Example runs: local-storybook, react-latest--vite.

What I verified in a real browser: the published internal-Storybook build from this branch's commit renders normally — manager and docs-block stories (e.g. ArgTypes, which go through the migrated createDocsContext loader) load and render with no fatal console errors.

Likely cause: this PR removes the window.__STORYBOOK_STORY_STORE__ emission from the iframe script. Chromatic's capture/verification client appears to still read that global when extracting stories — the removal lands on 11.0 nightlies before the capture client's feature-detected path (__STORYBOOK_PREVIEW__) is deployed. A recent PR from the same author (#36678) passes the same 15 chromatic jobs, so this is specific to the missing global, not to the account or baselines.

Everything else is green: internal-storybook-build-e2e, tests--linux, typescript-validation, eslint, knip-validation, format-check, and all sandbox e2e/vitest/dev jobs in the normal-generated workflow pass; the workflow-level failure is aggregated from the chromatic jobs.

If the capture client is indeed still on the legacy global, this PR may need to sequence after the capture-cloud update ships (or the chromatic jobs re-run once it's deployed). Happy to rebase/re-trigger then.

@vanessayuenn

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 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-12T19:23:40.458157Z 73b88a1 Manual request
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 73b88a1d19

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

Comment on lines +494 to +496
* @param importPaths the import paths of the CSF files, as they appear in the story index
* @param options.attach whether to attach the first CSF file to the context, making its stories
* the component stories of the context. Defaults to `true`, mirroring the dev Storybook loader.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Replace parameter tags with documented failure modes

Remove these @param tags and use the public API summary/type to explain attach; the repository's JSDoc rules explicitly prohibit @param while requiring @throws for caller-handled failures, but this method can reject both before preview initialization and when an import path is absent without documenting either condition. .agents/guidelines/comments-and-jsdoc.mdL37-L43

Useful? React with 👍 / 👎.

@obvious-autobuild
obvious-autobuild Bot marked this pull request as draft October 13, 2026 13:36
@obvious-autobuild

Copy link
Copy Markdown
Contributor Author

Holding this PR: the removal is delayed past 11.0. Chromatic's capture/extract client still reads the globals this PR removes (see the analysis above), and we are not asking Chromatic capture to change its client in this window — so merging now would break captures of 11.0+ builds. The PR stays up as a draft until the capture client migrates to the supported Preview APIs (__STORYBOOK_PREVIEW__ plus ready(), loadStory(), getStoryContext(), extract()). No review is expected in the meantime; the branch is left intact.

@obvious-autobuild obvious-autobuild Bot changed the title SB-2009: Remove deprecated direct Story Store access [SB-2009] Postpone Story Store access removal; keep the global emitted Oct 13, 2026
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor
Fails
🚫 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"
🚫 PR description is missing the mandatory "#### Manual testing" section. Please add it so that reviewers know how to manually test your changes.
🚫 This PR needs an approving review from a Storybook Core or Developer Experience team member before it can be merged. No approvals found.

Generated by 🚫 dangerJS against 12eede9

@obvious-autobuild
obvious-autobuild Bot marked this pull request as ready for review October 13, 2026 15:49
@ndelangen ndelangen closed this Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BREAKING CHANGE ci:normal Run our default set of CI jobs (choose this for most PRs). qa:needed Pull Requests that will need manual QA prior to release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants