Skip to content

fix: update default value for enableWebsockets in View component#890

Open
ndelangen wants to merge 2 commits into
nextfrom
norbert/auto-detect-websocketenabled
Open

fix: update default value for enableWebsockets in View component#890
ndelangen wants to merge 2 commits into
nextfrom
norbert/auto-detect-websocketenabled

Conversation

@ndelangen
Copy link
Copy Markdown
Member

@ndelangen ndelangen commented May 11, 2026

What I did

I made the enableWebsockets option auto-enable, based on the generated config runtime.

How to test

Provide environment variables for websockets, but don't explicitly setup enableWebsockets inside of .rnstorybook/index.tsx.

The expected outcome is that the storybook connects to the given websocket address.

Copilot AI review requested due to automatic review settings May 11, 2026 15:32
@ndelangen ndelangen requested a review from dannyhw as a code owner May 11, 2026 15:32
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 11, 2026

⚠️ No Changeset found

Latest commit: ef76194

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the React Native Storybook View.getStorybookUI defaults so WebSocket support is enabled automatically when a WebSocket configuration is injected via globalThis.STORYBOOK_WEBSOCKET (e.g., from generated storybook.requires).

Changes:

  • Change enableWebsockets default from false to Boolean(globalThis.STORYBOOK_WEBSOCKET) in View.getStorybookUI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 265 to 269
getStorybookUI = (params: Partial<Params> = {}) => {
const {
enableWebsockets = false,
enableWebsockets = !!globalThis.STORYBOOK_WEBSOCKET,
CustomUIComponent,
hasStoryWrapper: storyViewWrapper = true,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Update the documentation to match the implementation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Updated the JSDoc in ef76194 — the comment now reads:

default: automatically enabled when a websocket config is injected via storybook.requires (i.e. when STORYBOOK_WS_HOST is set), otherwise false

@dannyhw
Copy link
Copy Markdown
Member

dannyhw commented May 11, 2026

Can you add the changeset?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants