Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: Prerelease 8.0.0-alpha.8 #25449

Merged
merged 79 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
6f48577
Remove action args TS magic in favor of explicit fn args
kasperpeulen Dec 15, 2023
a4edb55
Remove addSpies as implicit actions can not be used as spy anymore in…
kasperpeulen Dec 15, 2023
00bc7f8
Turn disallowImplicitActionsInRenderV8 feature flag on by default
kasperpeulen Dec 15, 2023
d1c850a
Remove argTypesRegex from sb init
kasperpeulen Dec 15, 2023
d1c2b24
Merge branch 'next' into kasper/remove-ts-magic
ndelangen Dec 19, 2023
7c71684
Make sure story play function fails if there are any unhandled error
kasperpeulen Dec 22, 2023
53dd0e8
Merge remote-tracking branch 'origin/kasper/remove-ts-magic' into kas…
kasperpeulen Dec 22, 2023
1654326
Merge remote-tracking branch 'origin/next' into kasper/remove-ts-magic
kasperpeulen Dec 22, 2023
146cd79
Adjust all tests
kasperpeulen Dec 22, 2023
093ef7d
Adjust tests
kasperpeulen Dec 27, 2023
7a6b26a
Assign explicit actions to CLI stories
kasperpeulen Dec 28, 2023
386a063
Make storybook/test a dev dependency of docs for the template stories
kasperpeulen Dec 28, 2023
6ca55dc
Fix svelte TS issues
kasperpeulen Dec 28, 2023
a3e57b5
Always use the test package
kasperpeulen Dec 28, 2023
719c230
Fix svelte stories
kasperpeulen Dec 28, 2023
c1dfbda
Rename event
kasperpeulen Dec 28, 2023
994b1e7
Remove fn functions from svelte
kasperpeulen Dec 28, 2023
ad70a36
Docs: Composition adjustments for the removal of the extract function
jonniebigodes Dec 28, 2023
04fd27c
FIx JS story vue3
kasperpeulen Dec 29, 2023
294302c
Add a story for unhandled errors
kasperpeulen Dec 29, 2023
49dd963
Don't paste as it doesn't work anymore in the new version of user event
kasperpeulen Dec 29, 2023
829df7a
Add e2e tests for unhandled errors
kasperpeulen Dec 29, 2023
1a0943b
Make sure vue shows play function errors in interactions panel
kasperpeulen Jan 2, 2024
d249074
Merge remote-tracking branch 'origin/next' into kasper/remove-ts-magic
kasperpeulen Jan 2, 2024
578adba
Fix vue renderer in build
kasperpeulen Jan 2, 2024
7ed846e
Ignore angular, as they have no implicit action errors
kasperpeulen Jan 2, 2024
bdf758d
Ignore angular, as they have no implicit action errors
kasperpeulen Jan 2, 2024
18ce80b
Update code/renderers/vue3/template/cli/ts-3-8/Button.stories.ts
kasperpeulen Jan 2, 2024
3f19146
Update scripts/release/__tests__/label-patches.test.ts
kasperpeulen Jan 2, 2024
748b7e4
Roll back svelte change
kasperpeulen Jan 2, 2024
e326e21
Merge remote-tracking branch 'origin/kasper/remove-ts-magic' into kas…
kasperpeulen Jan 2, 2024
90e96d0
Documentation over fn action arg
kasperpeulen Jan 3, 2024
d4efd04
during playing -> while playing
kasperpeulen Jan 3, 2024
e62ed8c
Merge branch 'next' into docs_remove_extract_command
jonniebigodes Jan 3, 2024
9ff64bc
Merge pull request #25238 from storybookjs/kasper/remove-ts-magic
kasperpeulen Jan 4, 2024
645439a
React: Remove deprecated setGlobalConfig portable stories api
yannbf Jan 3, 2024
d2105f6
Merge pull request #25442 from storybookjs/yann/remove-portable-stori…
yannbf Jan 4, 2024
8c305f9
Builder Vite: Remove StorybookViteConfig type in favor of StorybookCo…
yannbf Jan 3, 2024
4211d75
add svelte dependency to root
JReinhold Jan 4, 2024
7dd8b28
Merge branch 'next' into fix-linked-svelte-sandbox
JReinhold Jan 4, 2024
d4d9648
Merge pull request #25441 from storybookjs/yann/remove-storybook-conf…
yannbf Jan 4, 2024
5e7c185
remove type and reference for --static-dir flag
yannbf Jan 4, 2024
32ec844
Merge pull request #25455 from storybookjs/fix-linked-svelte-sandbox
JReinhold Jan 4, 2024
470d2c8
Merge pull request #25415 from storybookjs/yann/remove-static-dir-flag
yannbf Jan 4, 2024
38cc3ee
UI: Remove deprecated WithTooltip props
yannbf Jan 3, 2024
1185e6f
replace deprecated props in addon themes
yannbf Jan 3, 2024
e3070fc
add tests in tooltip stories
yannbf Jan 3, 2024
92b8215
resolve snapshot flakiness once and for all
yannbf Jan 3, 2024
caf1644
add chromatic delay
yannbf Jan 4, 2024
6ab3320
fix ts error in story
yannbf Jan 4, 2024
d3f2e43
remove play fn
yannbf Jan 4, 2024
cca26e9
Merge pull request #25440 from storybookjs/yann/remove-deprecated-wit…
yannbf Jan 4, 2024
a576dc7
Addon Links: Remove LinkTo from direct import
yannbf Jan 2, 2024
7802938
Merge pull request #25418 from storybookjs/yann/remove-linkto-import
yannbf Jan 4, 2024
ff47477
Types: Remove Story, ComponentStory, ComponentStoryObj, ComponentStor…
yannbf Jan 5, 2024
ab8f5c5
Merge branch 'next' into docs_remove_extract_command
jonniebigodes Jan 5, 2024
82640ba
Merge pull request #25371 from storybookjs/docs_remove_extract_command
jonniebigodes Jan 5, 2024
e4196ed
More details for styling and css docs
Jan 5, 2024
871d749
fix stories
yannbf Jan 5, 2024
4c7e545
add codemod to migration notes
yannbf Jan 5, 2024
fe96e7f
Update docs/configure/styling-and-css.md
Jan 5, 2024
656adbe
Merge pull request #25477 from storybookjs/yann/remove-deprecated-sto…
yannbf Jan 5, 2024
7acfd6d
Types: Remove Framework in favor of Renderer types
yannbf Jan 5, 2024
020035f
Add missing content
Jan 5, 2024
aa4547d
Merge pull request #25476 from storybookjs/yann/remove-deprecated-fra…
yannbf Jan 5, 2024
95231f0
Manager API: Remove deprecated navigateToSettingsPage method
yannbf Jan 4, 2024
da912f6
Merge pull request #25479 from storybookjs/docs/styling-and-css
Jan 5, 2024
cc0f31c
Merge pull request #25467 from storybookjs/yann/remove-deprecated-nav…
yannbf Jan 5, 2024
b50aea9
Core: Remove storyIndexers in favor of experimental_indexers
yannbf Jan 4, 2024
b8f8745
TypeScript: Remove deprecated addons module types
yannbf Jan 5, 2024
03215bb
Merge pull request #25468 from storybookjs/yann/remove-deprecated-sto…
yannbf Jan 5, 2024
64a8709
Addon docs: Remove deprecated parameters
yannbf Jan 5, 2024
4a3639c
Merge pull request #25469 from storybookjs/yann/remove-deprecated-doc…
yannbf Jan 5, 2024
e858258
Doc blocks: Remove deprecated props from Description block
yannbf Jan 4, 2024
c624a02
Merge pull request #25457 from storybookjs/yann/remove-deprecated-des…
yannbf Jan 5, 2024
e82fe80
Core: Remove collapseAll and expandAll methods
yannbf Jan 5, 2024
e8278ce
Merge pull request #25486 from storybookjs/yann/remove-expand-collaps…
yannbf Jan 5, 2024
718f6d4
Merge pull request #25485 from storybookjs/yann/remove-deprecated-add…
yannbf Jan 5, 2024
d70a3bf
Write changelog for 8.0.0-alpha.8 [skip ci]
storybook-bot Jan 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGELOG.prerelease.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
## 8.0.0-alpha.8

- Addon Links: Remove LinkTo from direct import - [#25418](https://github.com/storybookjs/storybook/pull/25418), thanks [@yannbf](https://github.com/yannbf)!
- Addon docs: Remove deprecated parameters - [#25469](https://github.com/storybookjs/storybook/pull/25469), thanks [@yannbf](https://github.com/yannbf)!
- Builder Vite: Remove StorybookViteConfig type in favor of StorybookConfig - [#25441](https://github.com/storybookjs/storybook/pull/25441), thanks [@yannbf](https://github.com/yannbf)!
- Core: Error on explicit actions while rendering or playing - [#25238](https://github.com/storybookjs/storybook/pull/25238), thanks [@kasperpeulen](https://github.com/kasperpeulen)!
- Core: Remove collapseAll and expandAll methods - [#25486](https://github.com/storybookjs/storybook/pull/25486), thanks [@yannbf](https://github.com/yannbf)!
- Core: Remove storyIndexers in favor of experimental_indexers - [#25468](https://github.com/storybookjs/storybook/pull/25468), thanks [@yannbf](https://github.com/yannbf)!
- Core: Remove unused staticDir type - [#25415](https://github.com/storybookjs/storybook/pull/25415), thanks [@yannbf](https://github.com/yannbf)!
- Doc blocks: Remove deprecated props from Description block - [#25457](https://github.com/storybookjs/storybook/pull/25457), thanks [@yannbf](https://github.com/yannbf)!
- Manager API: Remove deprecated navigateToSettingsPage method - [#25467](https://github.com/storybookjs/storybook/pull/25467), thanks [@yannbf](https://github.com/yannbf)!
- React: Remove deprecated setGlobalConfig portable stories api - [#25442](https://github.com/storybookjs/storybook/pull/25442), thanks [@yannbf](https://github.com/yannbf)!
- TypeScript: Remove deprecated addons module types - [#25485](https://github.com/storybookjs/storybook/pull/25485), thanks [@yannbf](https://github.com/yannbf)!
- Types: Remove DecoratorFn, Story, ComponentStory, ComponentStoryObj, ComponentStoryFn and ComponentMeta types - [#25477](https://github.com/storybookjs/storybook/pull/25477), thanks [@yannbf](https://github.com/yannbf)!
- Types: Remove Framework in favor of Renderer types - [#25476](https://github.com/storybookjs/storybook/pull/25476), thanks [@yannbf](https://github.com/yannbf)!
- UI: Remove deprecated WithTooltip props - [#25440](https://github.com/storybookjs/storybook/pull/25440), thanks [@yannbf](https://github.com/yannbf)!

## 8.0.0-alpha.7

- Addon-Docs: Upgrade to MDX3 - [#25303](https://github.com/storybookjs/storybook/pull/25303), thanks [@yannbf](https://github.com/yannbf)!
Expand Down
156 changes: 150 additions & 6 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@
- [Require Svelte 4 and up](#require-svelte-4-and-up)
- [Deprecations which are now removed](#deprecations-which-are-now-removed)
- [--use-npm flag in storybook CLI](#--use-npm-flag-in-storybook-cli)
- [`setGlobalConfig` from `@storybook/react`](#setglobalconfig-from-storybookreact)
- [StorybookViteConfig type from @storybook/builder-vite](#storybookviteconfig-type-from-storybookbuilder-vite)
- [props from WithTooltipComponent from @storybook/components](#props-from-withtooltipcomponent-from-storybookcomponents)
- [LinkTo direct import from addon-links](#linkto-direct-import-from-addon-links)
- [DecoratorFn, Story, ComponentStory, ComponentStoryObj, ComponentStoryFn and ComponentMeta TypeScript types](#decoratorfn-story-componentstory-componentstoryobj-componentstoryfn-and-componentmeta-typescript-types)
- ["Framework" TypeScript types](#framework-typescript-types)
- [`navigateToSettingsPage` method from Storybook's manager-api](#navigatetosettingspage-method-from-storybooks-manager-api)
- [storyIndexers](#storyindexers)
- [Deprecated docs parameters](#deprecated-docs-parameters)
- [Description Doc block properties](#description-doc-block-properties)
- [Manager API expandAll and collapseAll methods](#manager-api-expandall-and-collapseall-methods)
- [From version 7.5.0 to 7.6.0](#from-version-750-to-760)
- [CommonJS with Vite is deprecated](#commonjs-with-vite-is-deprecated)
- [Using implicit actions during rendering is deprecated](#using-implicit-actions-during-rendering-is-deprecated)
Expand Down Expand Up @@ -573,6 +584,112 @@ Starting in 8.0, Storybook requires Svelte 4 and up.

The `--use-npm` is now removed. Use `--package-manager=npm` instead. [More info here](#cli-option---use-npm-deprecated).

#### `setGlobalConfig` from `@storybook/react`

The `setGlobalConfig` (used for reusing stories in your tests) is now removed in favor of `setProjectAnnotations`.

```ts
import { setProjectAnnotations } from `@storybook/testing-react`.
```

#### StorybookViteConfig type from @storybook/builder-vite

The `StorybookViteConfig` type is now removed in favor of `StorybookConfig`:

```ts
import type { StorybookConfig } from '@storybook/react-vite';
```

#### props from WithTooltipComponent from @storybook/components

The deprecated properties `tooltipShown`, `closeOnClick`, and `onVisibilityChange` of `WithTooltipComponent` from `@storybook/components` are now removed. Please replace them:

```tsx
<WithTooltip
closeOnClick // becomes closeOnOutsideClick
tooltipShown // becomes defaultVisible
onVisibilityChange // becomes onVisibleChange
>
...
</WithTooltip>
```

#### LinkTo direct import from addon-links

The `LinkTo` (React component) direct import from `@storybook/addon-links` is now removed. You have to import it from `@storybook/addon-links/react` instead.

```ts
// before
import LinkTo from '@storybook/addon-links';

// after
import LinkTo from '@storybook/addon-links/react';
```

#### DecoratorFn, Story, ComponentStory, ComponentStoryObj, ComponentStoryFn and ComponentMeta TypeScript types

The `Story` type is now removed in favor of `StoryFn` and `StoryObj`. More info [here](#story-type-deprecated).

The `DecoratorFn` type is now removed in favor of `Decorator`. [More info](#renamed-decoratorfn-to-decorator).

For React, the `ComponentStory`, `ComponentStoryObj`, `ComponentStoryFn` and `ComponentMeta` types are now removed in favor of `StoryFn`, `StoryObj` and `Meta`. [More info](#componentstory-componentstoryobj-componentstoryfn-and-componentmeta-types-are-deprecated).

#### "Framework" TypeScript types

The Framework types such as `ReactFramework` are now removed in favor of Renderer types such as `ReactRenderer`. This affects all frameworks. [More info](#renamed-xframework-to-xrenderer).

#### `navigateToSettingsPage` method from Storybook's manager-api

The `navigateToSettingsPage` method from manager-api is now removed in favor of `changeSettingsTab`.

```ts
export const Component = () => {
const api = useStorybookApi();

const someHandler = () => {
// Old method: api.navigateToSettingsPage('/settings/about');
api.changeSettingsTab('about'); // the /settings path is not necessary anymore
};

// ...
}
```

#### storyIndexers

The Storybook's main.js configuration property `storyIndexers` is now removed in favor of `experimental_indexers`. [More info](#storyindexers-is-replaced-with-experimental_indexers).

#### Deprecated docs parameters

The following story and meta parameters are now removed:

```ts
parameters.docs.iframeHeight // becomes docs.story.iframeHeight
parameters.docs.inlineStories // becomes docs.story.inline
parameters.jsx.transformSource // becomes parameters.docs.source.transform
parameters.docs.transformSource // becomes parameters.docs.source.transform
parameters.docs.source.transformSource // becomes parameters.docs.source.transform
```

More info [here](#autodocs-changes) and [here](#source-block).

#### Description Doc block properties

`children`, `markdown` and `type` are now removed in favor of the `of` property. [More info](#doc-blocks).

#### Manager API expandAll and collapseAll methods

The `collapseAll` and `expandAll` APIs (possibly used by addons) are now removed. Please emit events for these actions instead:

```ts
import { STORIES_COLLAPSE_ALL, STORIES_EXPAND_ALL } from '@storybook/core-events';
import { useStorybookApi } from '@storybook/manager-api';

const api = useStorybookApi()
api.collapseAll() // becomes api.emit(STORIES_COLLAPSE_ALL)
api.expandAll() // becomes api.emit(STORIES_EXPAND_ALL)
```

## From version 7.5.0 to 7.6.0

#### CommonJS with Vite is deprecated
Expand Down Expand Up @@ -2168,6 +2285,8 @@ During the 7.0 dev cycle we will be preparing recommendations and utilities to m

#### `Story` type deprecated

_Has codemod_

In 6.x you were able to do this:

```ts
Expand All @@ -2176,24 +2295,43 @@ import type { Story } from '@storybook/react';
export const MyStory: Story = () => <div />;
```

But this will produce a deprecation warning in 7.0 because `Story` has been deprecated.
To fix the deprecation warning, use the `StoryFn` type:
However with the introduction of CSF3, the `Story` type has been deprecated in favor of two other types: `StoryFn` for CSF2 and `StoryObj` for CSF3.

```ts
import type { StoryFn } from '@storybook/react';
import type { StoryFn, StoryObj } from '@storybook/react';

export const MyStory: StoryFn = () => <div />;
export const MyCsf2Story: StoryFn = () => <div />;
export const MyCsf3Story: StoryObj = {
render: () => <div />
};
```

This change is part of our move to CSF3, which uses objects instead of functions to represent stories.
You can read more about the CSF3 format here: https://storybook.js.org/blog/component-story-format-3-0/

We have set up a codemod that attempts to automatically migrate your code for you (update the glob to suit your needs):

```
npx storybook@next migrate upgrade-deprecated-types --glob="**/*.stories.tsx"
```

#### `ComponentStory`, `ComponentStoryObj`, `ComponentStoryFn` and `ComponentMeta` types are deprecated

The type of StoryObj and StoryFn have been changed in 7.0 so that both the "component" as "the props of the component" will be accepted as the generic parameter.
_Has codemod_

The type of `StoryObj` and `StoryFn` have been changed in 7.0 so that both the "component" as "the props of the component" will be accepted as the generic parameter. You can now replace the types:

```
ComponentStory -> StoryFn (CSF2) or StoryObj (CSF3)
ComponentStoryObj -> StoryObj
ComponentStoryFn -> StoryFn
ComponentMeta -> Meta
```

Here are a few examples:

```ts
import type { Story } from '@storybook/react';
import type { StoryFn, StoryObj } from '@storybook/react';
import { Button, ButtonProps } from './Button';

// This works in 7.0, making the ComponentX types redundant.
Expand All @@ -2213,6 +2351,12 @@ export const CSF2Story: StoryFn<ButtonProps> = (args) => <Button {...args} />;
CSF2Story.args = { label: 'Label' };
```

We have set up a codemod that attempts to automatically migrate your code for you (update the glob to suit your needs):

```
npx storybook@next migrate upgrade-deprecated-types --glob="**/*.stories.tsx"
```

#### Renamed `renderToDOM` to `renderToCanvas`

The "rendering" function that renderers (ex-frameworks) must export (`renderToDOM`) has been renamed to `renderToCanvas` to acknowledge that some consumers of frameworks/the preview do not work with DOM elements.
Expand Down
2 changes: 1 addition & 1 deletion code/addons/docs/docs/docspage.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ addParameters({
});
```

With that function, anyone using the docs addon for `@storybook/vue` can make their stories render inline, either globally with the `inlineStories` docs parameter, or on a per-story-basis using the `inline` prop on the `<Story>` doc block. If you come up with an elegant and flexible implementation for the `prepareForInline` function for your own framework, let us know! We'd love to make it the default configuration, to make inline stories more accessible for a larger variety of frameworks!
With that function, anyone using the docs addon for `@storybook/vue` can make their stories render inline, either globally with the `docs.story.inline` parameter, or on a per-story-basis using the `inline` prop on the `<Story>` doc block. If you come up with an elegant and flexible implementation for the `prepareForInline` function for your own framework, let us know! We'd love to make it the default configuration, to make inline stories more accessible for a larger variety of frameworks!

## Show/Hide code

Expand Down
1 change: 1 addition & 0 deletions code/addons/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
"devDependencies": {
"@mdx-js/mdx": "^3.0.0",
"@rollup/pluginutils": "^5.0.2",
"@storybook/test": "workspace:*",
"typescript": "^5.3.2",
"vite": "^4.0.4"
},
Expand Down
3 changes: 2 additions & 1 deletion code/addons/docs/template/stories/docspage/basic.stories.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { global as globalThis } from '@storybook/global';
import { fn } from '@storybook/test';

export default {
component: globalThis.Components.Button,
tags: ['autodocs'],
args: { label: 'Click Me!' },
args: { label: 'Click Me!', onClick: fn() },
parameters: { chromatic: { disable: true } },
};

Expand Down
20 changes: 13 additions & 7 deletions code/addons/interactions/src/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import React, { Fragment, memo, useEffect, useMemo, useRef, useState } from 'rea
import { useAddonState, useChannel, useParameter } from '@storybook/manager-api';
import {
FORCE_REMOUNT,
IGNORED_EXCEPTION,
STORY_RENDER_PHASE_CHANGED,
STORY_THREW_EXCEPTION,
PLAY_FUNCTION_THREW_EXCEPTION,
UNHANDLED_ERRORS_WHILE_PLAYING,
} from '@storybook/core-events';
import { EVENTS, type Call, CallStates, type LogItem } from '@storybook/instrumenter';

Expand Down Expand Up @@ -91,6 +91,7 @@ export const Panel = memo<{ storyId: string }>(function PanelMemoized({ storyId
hasException: false,
caughtException: undefined,
interactionsCount: 0,
unhandledErrors: undefined,
});

// local state
Expand All @@ -104,6 +105,7 @@ export const Panel = memo<{ storyId: string }>(function PanelMemoized({ storyId
interactions = [],
isPlaying = false,
caughtException = undefined,
unhandledErrors = undefined,
} = addonState;

// Log and calls are tracked in a ref so we don't needlessly rerender.
Expand Down Expand Up @@ -157,6 +159,7 @@ export const Panel = memo<{ storyId: string }>(function PanelMemoized({ storyId
hasException: false,
caughtException: undefined,
interactionsCount: 0,
unhandledErrors: undefined,
});
return;
}
Expand All @@ -180,11 +183,10 @@ export const Panel = memo<{ storyId: string }>(function PanelMemoized({ storyId
set((s) => ({ ...s, isErrored: true }));
},
[PLAY_FUNCTION_THREW_EXCEPTION]: (e) => {
if (e?.message !== IGNORED_EXCEPTION.message) {
set((s) => ({ ...s, caughtException: e }));
} else {
set((s) => ({ ...s, caughtException: undefined }));
}
set((s) => ({ ...s, caughtException: e }));
},
[UNHANDLED_ERRORS_WHILE_PLAYING]: (e) => {
set((s) => ({ ...s, unhandledErrors: e }));
},
},
[collapsed]
Expand Down Expand Up @@ -224,7 +226,10 @@ export const Panel = memo<{ storyId: string }>(function PanelMemoized({ storyId
const [fileName] = storyFilePath.toString().split('/').slice(-1);
const scrollToTarget = () => scrollTarget?.scrollIntoView({ behavior: 'smooth', block: 'end' });

const hasException = !!caughtException || interactions.some((v) => v.status === CallStates.ERROR);
const hasException =
!!caughtException ||
!!unhandledErrors ||
interactions.some((v) => v.status === CallStates.ERROR);

if (isErrored) {
return <Fragment key="interactions" />;
Expand All @@ -240,6 +245,7 @@ export const Panel = memo<{ storyId: string }>(function PanelMemoized({ storyId
fileName={fileName}
hasException={hasException}
caughtException={caughtException}
unhandledErrors={unhandledErrors}
isPlaying={isPlaying}
pausedAt={pausedAt}
endRef={endRef}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ComponentStoryObj, ComponentMeta } from '@storybook/react';
import type { StoryObj, Meta } from '@storybook/react';
import { expect } from '@storybook/jest';
import { CallStates } from '@storybook/instrumenter';
import { userEvent, within } from '@storybook/testing-library';
Expand All @@ -7,7 +7,7 @@ import { getCalls } from '../mocks';
import { Interaction } from './Interaction';
import SubnavStories from './Subnav.stories';

type Story = ComponentStoryObj<typeof Interaction>;
type Story = StoryObj<typeof Interaction>;

export default {
title: 'Addons/Interactions/Interaction',
Expand All @@ -17,7 +17,7 @@ export default {
controls: SubnavStories.args.controls,
controlStates: SubnavStories.args.controlStates,
},
} as ComponentMeta<typeof Interaction>;
} as Meta<typeof Interaction>;

export const Active: Story = {
args: {
Expand Down
6 changes: 3 additions & 3 deletions code/addons/interactions/src/components/Interaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { MethodCall } from './MethodCall';
import { StatusIcon } from './StatusIcon';

import type { Controls } from './InteractionsPanel';
import { isJestError } from '../utils';

const MethodCallWrapper = styled.div(() => ({
fontFamily: typography.fonts.mono,
Expand Down Expand Up @@ -112,16 +113,15 @@ const RowMessage = styled('div')(({ theme }) => ({
},
}));

const Exception = ({ exception }: { exception: Call['exception'] }) => {
if (exception.message.startsWith('expect(')) {
export const Exception = ({ exception }: { exception: Call['exception'] }) => {
if (isJestError(exception)) {
return <MatcherResult {...exception} />;
}
const paragraphs = exception.message.split('\n\n');
const more = paragraphs.length > 1;
return (
<RowMessage>
<pre>{paragraphs[0]}</pre>

{exception.showDiff && exception.diff ? (
<>
<br />
Expand Down
Loading