diff --git a/CHANGELOG.md b/CHANGELOG.md index e39ebdce39e5..43fc923f19bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 9.1.7 + +- Dependencies: Update `vite-plugin-storybook-nextjs` to 2.0.7 - [#32331](https://github.com/storybookjs/storybook/pull/32331), thanks @k35o! +- React: Preserve `@ts-expect-error` in preview - [#32442](https://github.com/storybookjs/storybook/pull/32442), thanks @mrginglymus! +- Telemetry: Queue error reporting & filter browser-extention - [#32499](https://github.com/storybookjs/storybook/pull/32499), thanks @ndelangen! + ## 9.1.6 - CLI: Capture the version specifier used in `create-storybook` - [#32344](https://github.com/storybookjs/storybook/pull/32344), thanks @shilman! diff --git a/code/core/src/manager/globals-runtime.ts b/code/core/src/manager/globals-runtime.ts index efec08c4b07b..f1d64d954c65 100644 --- a/code/core/src/manager/globals-runtime.ts +++ b/code/core/src/manager/globals-runtime.ts @@ -10,11 +10,28 @@ globalPackages.forEach((key) => { globalThis[globalsNameReferenceMap[key]] = globalsNameValueMap[key]; }); +const queuedErrors: Error[] = []; + globalThis.sendTelemetryError = (error) => { - if (!shouldSkipError(error)) { - const channel = globalThis.__STORYBOOK_ADDONS_CHANNEL__; - channel.emit(TELEMETRY_ERROR, prepareForTelemetry(error)); + if (shouldSkipError(error)) { + return; + } + + const channel = globalThis.__STORYBOOK_ADDONS_CHANNEL__; + const preparedError = prepareForTelemetry(error); + + if (!channel) { + queuedErrors.push(preparedError); + return; } + + // Flush any queued errors first + while (queuedErrors.length > 0) { + const queuedError = queuedErrors.shift(); + channel.emit(TELEMETRY_ERROR, queuedError); + } + + channel.emit(TELEMETRY_ERROR, preparedError); }; // handle all uncaught errors at the root of the application and log to telemetry diff --git a/code/core/src/manager/utils/prepareForTelemetry.ts b/code/core/src/manager/utils/prepareForTelemetry.ts index 00cfdd35dd43..581ef0ddc950 100644 --- a/code/core/src/manager/utils/prepareForTelemetry.ts +++ b/code/core/src/manager/utils/prepareForTelemetry.ts @@ -25,6 +25,8 @@ const errorMessages = [ // Safari does not seem to provide any helpful info on window.onerror // https://bugs.webkit.org/show_bug.cgi?id=132945 'Script error.', + // When react-dev-tools is installed as a browser extension, it will log this error + 'React is running in production mode', ]; export const shouldSkipError = (error: Error) => errorMessages.includes(error?.message); diff --git a/code/frameworks/angular/template/components/form.component.ts b/code/frameworks/angular/template/components/form.component.ts index 272e79eebf7f..0d7316454a51 100644 --- a/code/frameworks/angular/template/components/form.component.ts +++ b/code/frameworks/angular/template/components/form.component.ts @@ -1,36 +1,39 @@ -import { Component, Output, EventEmitter } from '@angular/core'; +import { Component, output, signal } from '@angular/core'; +import { FormsModule } from '@angular/forms'; @Component({ - standalone: false, + standalone: true, + imports: [FormsModule], selector: 'storybook-form', template: ` -
+ -

Completed!!

+ @if (complete()) { +

Completed!!

+ }
`, }) export default class FormComponent { /** Optional success handler */ - @Output() - onSuccess = new EventEmitter(); + onSuccess = output(); value = ''; - complete = false; + complete = signal(false); handleSubmit(event: SubmitEvent) { event.preventDefault(); this.onSuccess.emit(this.value); setTimeout(() => { - this.complete = true; + this.complete.set(true); }, 500); setTimeout(() => { - this.complete = false; + this.complete.set(false); }, 1500); } } diff --git a/code/frameworks/nextjs-vite/package.json b/code/frameworks/nextjs-vite/package.json index 9bc0715b81df..aa1305949ef1 100644 --- a/code/frameworks/nextjs-vite/package.json +++ b/code/frameworks/nextjs-vite/package.json @@ -112,7 +112,7 @@ "@storybook/react": "workspace:*", "@storybook/react-vite": "workspace:*", "styled-jsx": "5.1.6", - "vite-plugin-storybook-nextjs": "^2.0.5" + "vite-plugin-storybook-nextjs": "^2.0.7" }, "devDependencies": { "@types/node": "^22.0.0", diff --git a/code/package.json b/code/package.json index 4f77ab2050c8..cb760aea0779 100644 --- a/code/package.json +++ b/code/package.json @@ -285,5 +285,6 @@ "Dependency Upgrades" ] ] - } + }, + "deferredNextVersion": "9.1.7" } diff --git a/code/renderers/react/src/preview.tsx b/code/renderers/react/src/preview.tsx index c46316fa0392..305688bbcb1d 100644 --- a/code/renderers/react/src/preview.tsx +++ b/code/renderers/react/src/preview.tsx @@ -48,7 +48,7 @@ export function __definePreview[]>( return preview; } -// @ts-expect-error We cannot implement the meta faithfully here, but that is okay. +/** @ts-expect-error We cannot implement the meta faithfully here, but that is okay. */ export interface ReactPreview extends Preview { meta< TArgs extends Args, @@ -81,7 +81,7 @@ type DecoratorsArgs = UnionToIntersectio >; interface ReactMeta> - // @ts-expect-error hard +/** @ts-expect-error hard */ extends Meta { // Required args don't need to be provided when the user uses an empty render story< @@ -105,7 +105,7 @@ interface ReactMeta, >( story?: TInput - // @ts-expect-error hard + /** @ts-expect-error hard */ ): ReactStory; } diff --git a/code/yarn.lock b/code/yarn.lock index a8c7916063b5..00edb5c9625a 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -6791,7 +6791,7 @@ __metadata: postcss-load-config: "npm:^6.0.1" styled-jsx: "npm:5.1.6" typescript: "npm:^5.8.3" - vite-plugin-storybook-nextjs: "npm:^2.0.5" + vite-plugin-storybook-nextjs: "npm:^2.0.7" peerDependencies: next: ^14.1.0 || ^15.0.0 react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta @@ -27061,9 +27061,9 @@ __metadata: languageName: node linkType: hard -"vite-plugin-storybook-nextjs@npm:^2.0.5": - version: 2.0.5 - resolution: "vite-plugin-storybook-nextjs@npm:2.0.5" +"vite-plugin-storybook-nextjs@npm:^2.0.7": + version: 2.0.7 + resolution: "vite-plugin-storybook-nextjs@npm:2.0.7" dependencies: "@next/env": "npm:^15.0.3" image-size: "npm:^2.0.0" @@ -27075,7 +27075,7 @@ __metadata: next: ^14.1.0 || ^15.0.0 storybook: ^0.0.0-0 || ^9.0.0 || ^9.1.0-0 vite: ^5.0.0 || ^6.0.0 || ^7.0.0 - checksum: 10c0/ee308c836c4380f9c9e3f51a7eab532eb648248cb8b78866032ed0e33af2cde3457e536e20c74546c46141d0b5ea9809ec13b76db299b8bd59468285228c3b1b + checksum: 10c0/a7e482cf11ca2201e82c8613eaece6848ff6634ee48b835e215b5f9e698bbbc2c013286487c0b9c0d8562f5d0bc23170d011471eaec0bdd52a34f2f1b1ff83d7 languageName: node linkType: hard diff --git a/docs/versions/latest.json b/docs/versions/latest.json index be86d960440f..60a3a7ef0336 100644 --- a/docs/versions/latest.json +++ b/docs/versions/latest.json @@ -1 +1 @@ -{"version":"9.1.6","info":{"plain":"- CLI: Capture the version specifier used in `create-storybook` - [#32344](https://github.com/storybookjs/storybook/pull/32344), thanks @shilman!\n- Instrumenter: Fix userEvent.type performance regression - [#32439](https://github.com/storybookjs/storybook/pull/32439), thanks @ndelangen!\n- React Native Web: Fix RNW peer dependency version - [#32438](https://github.com/storybookjs/storybook/pull/32438), thanks @dannyhw!\n- Telemetry: Record known CLI integrations - [#32448](https://github.com/storybookjs/storybook/pull/32448), thanks @shilman!"}} +{"version":"9.1.7","info":{"plain":"- Dependencies: Update `vite-plugin-storybook-nextjs` to 2.0.7 - [#32331](https://github.com/storybookjs/storybook/pull/32331), thanks @k35o!\n- React: Preserve `@ts-expect-error` in preview - [#32442](https://github.com/storybookjs/storybook/pull/32442), thanks @mrginglymus!\n- Telemetry: Queue error reporting & filter browser-extention - [#32499](https://github.com/storybookjs/storybook/pull/32499), thanks @ndelangen!"}} diff --git a/docs/versions/next.json b/docs/versions/next.json index aca7c902f6a8..16a95ef204fe 100644 --- a/docs/versions/next.json +++ b/docs/versions/next.json @@ -1 +1 @@ -{"version":"10.0.0-beta.2","info":{"plain":"- Build: Fix dts bundling external detection - [#32366](https://github.com/storybookjs/storybook/pull/32366), thanks @mrginglymus!\n- Codemod: Replace `globby` with `tinyglobby` - [#31407](https://github.com/storybookjs/storybook/pull/31407), thanks @benmccann!\n- Next.js-vite: Use `fileURLToPath` for module resolution in preset - [#32386](https://github.com/storybookjs/storybook/pull/32386), thanks @ndelangen!\n- Tags: Remove undocumented x-only tags - [#32360](https://github.com/storybookjs/storybook/pull/32360), thanks @shilman!\n- Vitest addon: Handle Playwright installation errors gracefully - [#32329](https://github.com/storybookjs/storybook/pull/32329), thanks @ndelangen!"}} +{"version":"10.0.0-beta.5","info":{"plain":"- Dependencies: Update `vite-plugin-storybook-nextjs` to 2.0.7 - [#32331](https://github.com/storybookjs/storybook/pull/32331), thanks @k35o!\n- Fix: ESLint plugin homepage URL updates - [#32445](https://github.com/storybookjs/storybook/pull/32445), thanks @VivekKavala!\n- Upgrades: Packages `boxen` `commander` `giget` - [#32469](https://github.com/storybookjs/storybook/pull/32469), thanks @ndelangen!"}} \ No newline at end of file