Skip to content

Commit

Permalink
Merge pull request #26370 from storybookjs/version-non-patch-from-8.0…
Browse files Browse the repository at this point in the history
….0-rc.3

Release: Prerelease 8.0.0-rc.4
  • Loading branch information
vanessayuenn authored Mar 11, 2024
2 parents d6f8526 + a6e4d90 commit 46bc788
Show file tree
Hide file tree
Showing 142 changed files with 2,499 additions and 966 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.prerelease.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## 8.0.0-rc.4

- Actions: Fix attaching action after a spy is restored to original function - [#26364](https://github.com/storybookjs/storybook/pull/26364), thanks @kasperpeulen!
- CLI: Add explicit actions to header story - [#26352](https://github.com/storybookjs/storybook/pull/26352), thanks @kasperpeulen!
- CLI: Automigration for upgrading storybook related dependencies - [#26377](https://github.com/storybookjs/storybook/pull/26377), thanks @ndelangen!
- CLI: Fix doctor compatibility check - [#26363](https://github.com/storybookjs/storybook/pull/26363), thanks @yannbf!
- CLI: Fix fn reference in preact templates - [#26384](https://github.com/storybookjs/storybook/pull/26384), thanks @kasperpeulen!
- CLI: Remove duplicated dependency warning - [#26385](https://github.com/storybookjs/storybook/pull/26385), thanks @yannbf!
- CLI: Vite migration link (shorter) - [#26379](https://github.com/storybookjs/storybook/pull/26379), thanks @ndelangen!
- Composition: Fix refs not loading when there's multiple - [#26356](https://github.com/storybookjs/storybook/pull/26356), thanks @ndelangen!
- Dependencies: Broaden `esbuild` version range - [#26405](https://github.com/storybookjs/storybook/pull/26405), thanks @ndelangen!
- Maintenance: Replace `@storybook/testing-library` with `@storybook/test` in monorepo - [#26351](https://github.com/storybookjs/storybook/pull/26351), thanks @ndelangen!
- Maintenance: What's new modal changes - [#26355](https://github.com/storybookjs/storybook/pull/26355), thanks @kasperpeulen!
- Portable Stories: Fix injected root element changing layout - [#26387](https://github.com/storybookjs/storybook/pull/26387), thanks @JReinhold!
- React: Support all React component types in JSX Decorator - [#26382](https://github.com/storybookjs/storybook/pull/26382), thanks @yannbf!

## 8.0.0-rc.3

- Addon-themes: Fix switcher initialization after first start - [#26353](https://github.com/storybookjs/storybook/pull/26353), thanks @valentinpalkovic!
Expand Down
31 changes: 1 addition & 30 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
- [Portable stories](#portable-stories)
- [Project annotations are now merged instead of overwritten in composeStory](#project-annotations-are-now-merged-instead-of-overwritten-in-composestory)
- [Type change in `composeStories` API](#type-change-in-composestories-api)
- [DOM structure changed in portable stories](#dom-structure-changed-in-portable-stories)
- [Composed Vue stories are now components instead of functions](#composed-vue-stories-are-now-components-instead-of-functions)
- [Tab addons are now routed to a query parameter](#tab-addons-are-now-routed-to-a-query-parameter)
- [Default keyboard shortcuts changed](#default-keyboard-shortcuts-changed)
Expand Down Expand Up @@ -440,35 +439,6 @@ await Primary.play!(...) // if you want a runtime error when the play function d

There are plans to make the type of the play function be inferred based on your imported story's play function in a near future, so the types will be 100% accurate.

#### DOM structure changed in portable stories

The portable stories API now adds a wrapper to your stories with a unique id based on your story id, such as:

```html
<div data-story="true" id="#storybook-story-button--primary">
<!-- your story here -->
</div>
```

This means that if you take DOM snapshots of your stories, they will be affected and you will have to update them.

The id calculation is based on different heuristics based on your Meta title and Story name. When using `composeStories`, the id can be inferred automatically. However, when using `composeStory` and your story does not explicitly have a `storyName` property, the story name can't be inferred automatically. As a result, its name will be "Unnamed Story", resulting in a wrapper id like `"#storybook-story-button--unnamed-story"`. If the id matters to you and you want to fix it, you have to specify the `exportsName` property like so:

```ts
test("snapshots the story with custom id", () => {
const Primary = composeStory(
stories.Primary,
stories.default,
undefined,
// If you do not want the `unnamed-story` id, you have to pass the name of the story as a parameter
"Primary"
);

const { baseElement } = render(<Primary />);
expect(baseElement).toMatchSnapshot();
});
```

#### Composed Vue stories are now components instead of functions

`composeStory` (and `composeStories`) from `@storybook/vue3` now return Vue components rather than story functions that return components. This means that when rendering these composed stories you just pass the composed story _without_ first calling it.
Expand Down Expand Up @@ -1105,6 +1075,7 @@ const preview: Preview = {

export default preview;
```

To learn more about the available icons and their names, see the [Storybook documentation](https://storybook.js.org/docs/8.0/faq#what-icons-are-available-for-my-toolbar-or-my-addon).

#### Removals in @storybook/types
Expand Down
8 changes: 7 additions & 1 deletion code/addons/actions/src/loaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import type { LoaderFunction } from '@storybook/types';
import { action } from './runtime';

export const tinySpyInternalState = Symbol.for('tinyspy:spy');

const attachActionsToFunctionMocks: LoaderFunction = (context) => {
const {
args,
Expand All @@ -15,7 +17,11 @@ const attachActionsToFunctionMocks: LoaderFunction = (context) => {
typeof value === 'function' && '_isMockFunction' in value && value._isMockFunction
)
.forEach(([key, value]) => {
const previous = value.getMockImplementation();
// See this discussion for context:
// https://github.com/vitest-dev/vitest/pull/5352
const previous =
value.getMockImplementation() ??
(tinySpyInternalState in value ? value[tinySpyInternalState]?.getOriginal() : undefined);
if (previous?._actionAttached !== true && previous?.isAction !== true) {
const implementation = (...params: unknown[]) => {
action(key)(...params);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { global as globalThis } from '@storybook/global';
import { expect } from '@storybook/test';
import { within } from '@storybook/testing-library';
import { expect, within } from '@storybook/test';

export default {
component: globalThis.Components.Pre,
Expand Down
2 changes: 1 addition & 1 deletion code/addons/interactions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@storybook/instrumenter": "workspace:*",
"@storybook/manager-api": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/testing-library": "next",
"@storybook/test": "workspace:*",
"@storybook/theming": "workspace:*",
"@types/node": "^18.0.0",
"formik": "^2.2.9",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { StoryObj, Meta } from '@storybook/react';
import { expect } from '@storybook/test';
import { CallStates } from '@storybook/instrumenter';
import { userEvent, within } from '@storybook/testing-library';
import { userEvent, within, expect } from '@storybook/test';
import { getCalls } from '../mocks';

import { Interaction } from './Interaction';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import React from 'react';
import type { StoryObj, Meta } from '@storybook/react';
import { CallStates } from '@storybook/instrumenter';
import { styled } from '@storybook/theming';
import { userEvent, within, waitFor } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { userEvent, within, waitFor, expect } from '@storybook/test';
import isChromatic from 'chromatic/isChromatic';

import { getCalls, getInteractions } from '../mocks';
Expand Down
1 change: 0 additions & 1 deletion code/addons/onboarding/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"@storybook/react": "workspace:*",
"@storybook/telemetry": "workspace:*",
"@storybook/test": "workspace:*",
"@storybook/testing-library": "next",
"@storybook/theming": "workspace:*",
"@storybook/types": "workspace:*",
"framer-motion": "^11.0.3",
Expand Down
3 changes: 1 addition & 2 deletions code/addons/onboarding/src/components/List/List.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useState } from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import { userEvent, waitFor, within } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { userEvent, waitFor, within, expect } from '@storybook/test';

import { List } from './List';
import { ListItem } from './ListItem/ListItem';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useState } from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import { userEvent, within } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { userEvent, within, expect } from '@storybook/test';

import { Modal } from './Modal';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { Meta, StoryObj } from '@storybook/react';
import { PulsatingEffect } from './PulsatingEffect';
import React from 'react';
import { within } from '@storybook/testing-library';
import { expect } from '@storybook/test';
import { within, expect } from '@storybook/test';

const meta: Meta<typeof PulsatingEffect> = {
component: PulsatingEffect,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import type { Meta, StoryObj } from '@storybook/react';

import { waitFor, within } from '@storybook/testing-library';
import { expect, fn } from '@storybook/test';
import { waitFor, within, expect, fn } from '@storybook/test';
import { STORY_INDEX_INVALIDATED, STORY_RENDERED } from '@storybook/core-events';
import { WriteStoriesModal } from './WriteStoriesModal';
import typescriptSnippet from './code/typescript';
Expand Down
2 changes: 1 addition & 1 deletion code/builders/builder-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.10",
"browser-assert": "^1.2.1",
"ejs": "^3.1.8",
"esbuild": "^18.0.0 || ^19.0.0 || ^0.20.0",
"esbuild": "^0.18.0 || ^0.19.0 || ^0.20.0",
"esbuild-plugin-alias": "^0.2.1",
"express": "^4.17.3",
"fs-extra": "^11.1.0",
Expand Down
Loading

0 comments on commit 46bc788

Please sign in to comment.