Repository navigation
React: Raise the supported floor to 18 #36169
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
17672e0
chore(peers): require react ^18.0.0 || ^19.0.0
ObviousApp 9619b10
feat(autoblock): block upgrades on react < 18
ObviousApp d6254fe
refactor(react-dom-shim): remove the react-16 path
ObviousApp b6b5545
chore(sandboxes): remove the react-webpack/17-ts template
ObviousApp 92ecebc
docs(migration): document the React 18 floor
ObviousApp 73fe3cf
chore(deps): sync yarn.lock with react 18 peer floor
ObviousApp 1fc3014
style(docs): re-align framework options table for oxfmt
ObviousApp 0ee0902
docs(migration): move the react floor entry under 11.0.0
ObviousApp 1d807f3
fix(autoblock): treat react 0.0.0 canary builds as supported
ObviousApp 7d75f4f
test(e2e-sandbox): drop the dead react 17 expectation branch
ObviousApp 0e5901d
test(autoblock): cover the react 0.0.0 canary pass-through
ObviousApp 72afbe9
refactor(react-dom-shim): drop the obsolete react version detection
ObviousApp acf024c
Fix React minimum-version upgrade guidance
valentinpalkovic d9a1378
Fix Preact docs React version expectation after rebase
valentinpalkovic 77eddef
Merge remote-tracking branch 'origin/next' into feat/react-18-floor
ObviousApp 86bc7f4
feat(autoblock): block upgrade when legacyRootApi is still set
ObviousApp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
code/lib/cli-storybook/src/autoblock/block-react-legacy-root-api.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| import { describe, expect, test } from 'vitest'; | ||
|
|
||
| import type { StorybookConfig } from 'storybook/internal/types'; | ||
|
|
||
| import { blocker } from './block-react-legacy-root-api.ts'; | ||
|
|
||
| const check = (framework: StorybookConfig['framework']) => | ||
| blocker.check({ | ||
| packageManager: {} as any, | ||
| mainConfig: { stories: [], framework } as StorybookConfig, | ||
| mainConfigPath: '.storybook/main.ts', | ||
| configDir: '.storybook', | ||
| }); | ||
|
|
||
| describe('blocks', () => { | ||
| test('when legacyRootApi is true', async () => { | ||
| await expect( | ||
| check({ name: '@storybook/react-vite', options: { legacyRootApi: true } }) | ||
| ).resolves.toBe(true); | ||
| }); | ||
|
|
||
| // The option no longer exists, so an explicit `false` must be removed as well. | ||
| test('when legacyRootApi is false', async () => { | ||
| await expect( | ||
| check({ name: '@storybook/react-vite', options: { legacyRootApi: false } }) | ||
| ).resolves.toBe(true); | ||
| }); | ||
|
|
||
| test('when legacyRootApi is set on react-webpack5', async () => { | ||
| await expect( | ||
| check({ name: '@storybook/react-webpack5', options: { legacyRootApi: true } }) | ||
| ).resolves.toBe(true); | ||
| }); | ||
| }); | ||
|
|
||
| describe('does not block', () => { | ||
| test('when framework has no options', async () => { | ||
| await expect(check({ name: '@storybook/react-vite' })).resolves.toBe(false); | ||
| }); | ||
|
|
||
| test('when options omit legacyRootApi', async () => { | ||
| await expect(check({ name: '@storybook/react-vite', options: { builder: {} } })).resolves.toBe( | ||
| false | ||
| ); | ||
| }); | ||
|
|
||
| test('when framework is a bare string', async () => { | ||
| await expect(check('@storybook/react-vite')).resolves.toBe(false); | ||
| }); | ||
|
|
||
| test('when framework is undefined', async () => { | ||
| await expect(check(undefined)).resolves.toBe(false); | ||
| }); | ||
| }); | ||
|
|
||
| describe('log', () => { | ||
| test('names the option, both values, and links React upgrade guidance', () => { | ||
| const { title, message, link } = blocker.log(true); | ||
|
|
||
| expect(title).toBe('React legacy root API removed'); | ||
| expect(message).toContain('legacyRootApi'); | ||
| expect(message).toContain('`true` or `false`'); | ||
| expect(message).toContain('https://react.dev/blog/2022/03/08/react-18-upgrade-guide'); | ||
| expect(link).toBe( | ||
| 'https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#react-require-v18-and-up' | ||
| ); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.