From 26094d3ed510a3ce9d0db243571a82325ca8ca1d Mon Sep 17 00:00:00 2001 From: yannbf Date: Fri, 17 Apr 2026 09:21:10 +0200 Subject: [PATCH 1/2] skip ai prompts in react native --- code/lib/create-storybook/src/initiate.ts | 2 +- .../FeatureCompatibilityService.test.ts | 25 +++++++++++++++---- .../services/FeatureCompatibilityService.ts | 12 ++++++--- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/code/lib/create-storybook/src/initiate.ts b/code/lib/create-storybook/src/initiate.ts index c566d71fa924..0b0a05809433 100644 --- a/code/lib/create-storybook/src/initiate.ts +++ b/code/lib/create-storybook/src/initiate.ts @@ -48,7 +48,7 @@ async function checkFeatureSupport( process.cwd() ); - const aiSetup = FeatureCompatibilityService.supportsAISetupFeature(renderer, builder); + const aiSetup = FeatureCompatibilityService.supportsAISetupFeature(renderer, builder, framework); return { isTestFeatureAvailable: result.compatible, diff --git a/code/lib/create-storybook/src/services/FeatureCompatibilityService.test.ts b/code/lib/create-storybook/src/services/FeatureCompatibilityService.test.ts index 93e0b7b71042..6d2affc0988c 100644 --- a/code/lib/create-storybook/src/services/FeatureCompatibilityService.test.ts +++ b/code/lib/create-storybook/src/services/FeatureCompatibilityService.test.ts @@ -49,7 +49,8 @@ describe('FeatureCompatibilityService', () => { expect( FeatureCompatibilityService.supportsAISetupFeature( SupportedRenderer.REACT, - SupportedBuilder.VITE + SupportedBuilder.VITE, + SupportedFramework.REACT_VITE ) ).toBe(true); }); @@ -58,7 +59,8 @@ describe('FeatureCompatibilityService', () => { expect( FeatureCompatibilityService.supportsAISetupFeature( SupportedRenderer.VUE3, - SupportedBuilder.VITE + SupportedBuilder.VITE, + SupportedFramework.VUE3_VITE ) ).toBe(false); }); @@ -67,7 +69,8 @@ describe('FeatureCompatibilityService', () => { expect( FeatureCompatibilityService.supportsAISetupFeature( SupportedRenderer.REACT, - SupportedBuilder.WEBPACK5 + SupportedBuilder.WEBPACK5, + SupportedFramework.REACT_WEBPACK5 ) ).toBe(false); }); @@ -76,14 +79,26 @@ describe('FeatureCompatibilityService', () => { expect( FeatureCompatibilityService.supportsAISetupFeature( SupportedRenderer.ANGULAR, - SupportedBuilder.WEBPACK5 + SupportedBuilder.WEBPACK5, + SupportedFramework.ANGULAR ) ).toBe(false); expect( FeatureCompatibilityService.supportsAISetupFeature( SupportedRenderer.SVELTE, - SupportedBuilder.WEBPACK5 + SupportedBuilder.WEBPACK5, + null + ) + ).toBe(false); + }); + + it('should return false for react-native-web-vite framework', () => { + expect( + FeatureCompatibilityService.supportsAISetupFeature( + SupportedRenderer.REACT, + SupportedBuilder.VITE, + SupportedFramework.REACT_NATIVE_WEB_VITE ) ).toBe(false); }); diff --git a/code/lib/create-storybook/src/services/FeatureCompatibilityService.ts b/code/lib/create-storybook/src/services/FeatureCompatibilityService.ts index 3097b2406b2d..8e8f2a7b611c 100644 --- a/code/lib/create-storybook/src/services/FeatureCompatibilityService.ts +++ b/code/lib/create-storybook/src/services/FeatureCompatibilityService.ts @@ -1,7 +1,6 @@ import { AddonVitestService, ProjectType } from 'storybook/internal/cli'; import type { JsPackageManager } from 'storybook/internal/common'; -import type { SupportedFramework } from 'storybook/internal/types'; -import { SupportedBuilder, SupportedRenderer } from 'storybook/internal/types'; +import { SupportedBuilder, SupportedFramework, SupportedRenderer } from 'storybook/internal/types'; /** Project types that support the onboarding feature */ const ONBOARDING_PROJECT_TYPES: ProjectType[] = [ @@ -34,7 +33,14 @@ export class FeatureCompatibilityService { } /** Check if AI-assisted setup (storybook ai setup) is supported for this project configuration */ - static supportsAISetupFeature(renderer: SupportedRenderer, builder: SupportedBuilder): boolean { + static supportsAISetupFeature( + renderer: SupportedRenderer, + builder: SupportedBuilder, + framework: SupportedFramework | null + ): boolean { + if (framework === SupportedFramework.REACT_NATIVE_WEB_VITE) { + return false; + } return renderer === SupportedRenderer.REACT && builder === SupportedBuilder.VITE; } From fe2b0c9661a7a7802b2642eebe46a38a2aad3fc4 Mon Sep 17 00:00:00 2001 From: yannbf Date: Fri, 17 Apr 2026 12:59:27 +0200 Subject: [PATCH 2/2] fix tests --- code/core/src/core-server/build-dev.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/core/src/core-server/build-dev.ts b/code/core/src/core-server/build-dev.ts index 1068368efb28..5de72fdfdae3 100644 --- a/code/core/src/core-server/build-dev.ts +++ b/code/core/src/core-server/build-dev.ts @@ -65,7 +65,9 @@ export async function resolveOnboardingInitialPath( } const onboardingPending = await cache.get('onboarding-pending').catch(() => {}); if (onboardingPending) { - await cache.remove('onboarding-pending').catch(() => {}); + try { + await cache.remove('onboarding-pending'); + } catch {} return '/onboarding'; } return undefined;