Repository navigation
chore: drop the addEventListener workaround now that Storybook 11.0.0-beta.1 guards it - #966
Merged
Merged
Conversation
…-beta.1 guards it storybookjs/storybook#37183 shipped in 11.0.0-beta.1, so PreviewWithSelection no longer calls window.addEventListener when the global doesn't have it. Remove the setupListeners override, update Storybook to 11.0.0-beta.1 and raise the storybook peer floors to it.
🦋 Changeset detectedLatest commit: c7c8197 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…k packages @storybook/mcp is released in step with storybook now, so update-storybook-deps no longer skips it. Also point the select-story tool at docs-list, the current name of the documentation list tool.
dannyhw
marked this pull request as ready for review
November 10, 2026 00:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #958.
storybookjs/storybook#37183 ("Preview API: Skip the landmark navigation listener in RN") shipped in
storybook@11.0.0-beta.1. It's in the release notes, and the published package callsaddEventListener?.("react-aria-landmark-navigation", …). To check, I extractednpm pack storybook@11.0.0-beta.1and rangrep -rl 'addEventListener?.("react-aria-landmark-navigation"' package/dist. It matchesdist/preview/_chunks/runtime-*.jsanddist/_browser-chunks/chunk-*.js. With that guard in Storybook itself, our workaround isn't needed.Changes
packages/react-native/src/Start.tsx: removed thesetupListeners()override inReactNativePreviewthat briefly stubbedglobalThis.addEventListener, along with its comment and TODO.renderSelectionandteardownRenderare unchanged.storybookand@storybook/*dependencies and devDependencies are now^11.0.0-beta.1(viapnpm update-storybook-deps --version '^11.0.0-beta.1'), and the lockfile is updated. The lockfile loses some entries because beta.1 bundles its test libraries (Test: Bundle the test libraries and their types, upgrade to Vitest 5 storybook#37143) and makes react-docgen optional (React: Make react-docgen optional and drop builder docgen deps from the default install storybook#37141).Peer floors are raised from
^11.0.0-beta.0to^11.0.0-beta.1. That'sstorybookin every package, plus@storybook/reactinaddon-ondevice-notes. No other peers changed.A patch changeset for
@storybook/react-native.@storybook/mcpis updated from^10.6.0to^11.0.0-beta.1.update-storybook-depshad it on its ignore list from when it had its own0.xversions. Since 10.6 it's released alongsidestorybook, so the script now includes it. Only@storybook/addon-react-native-serveris still skipped.The
select-storyMCP tool's description pointed agents atlist-all-documentation, a tool@storybook/mcpalready callsdocs-list(in 10.6.6 too). It now saysdocs-listwithwithStoryIds: true.Checks
All of these pass:
pnpm installpnpm buildpnpm test:packages/react-native79 tests, includingstorySorts.test.tsandupdateView.test.ts, which failed without the workaround;expo-example32 passed, 2 skipped; plus thetestspackage (node test runner),ondevice-actionsandreact-native-uipnpm check:typespnpm lintpnpm format:checkpnpm repo:lintDevice testing
I ran
examples/expo-exampleagainst this branch's Metro on an iOS 27 simulator (iPhone 17e) and an Android 15 emulator (Pixel 9), both using SDK 58 / RN 0.88 dev builds.addEventListener?.("react-aria-landmark-navigation", …)and none of the removed stub.nextalso shows.select-story-sync) and in the on-device story list (Boolean / On) renders it.updateStoryArgsevent re-renders the story with the new args.MCP server
With
@storybook/mcp11.0.0-beta.1 I started Metro forexamples/expo-exampleand called the server athttp://localhost:7007/mcpdirectly.initializeandtools/listwork, andtools/listreturnsdocs-list,docs-show,docs-show-story,get-storybook-story-instructionsandselect-story.docs-listlists the example's components.docs-show(controlexamples-controlexample) returns its props.docs-show-story(controlexamples-controlexample--example) returns the story snippet.select-story(controlexamples-boolean--on) reports the story as selected.After the bump,
pnpm build,test,check:types,lint,format:checkandrepo:lintall pass.