-
Notifications
You must be signed in to change notification settings - Fork 951
Upgrade React from 17 to 19 #10295
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
base: master
Are you sure you want to change the base?
Upgrade React from 17 to 19 #10295
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,12 @@ | ||
| import React from 'react'; | ||
| import ReactDOM from 'react-dom'; | ||
| import { createRoot } from 'react-dom/client'; | ||
|
|
||
| // let docs = []; | ||
| let root; | ||
|
|
||
| export function addDocs(docs: any[]) { | ||
| const Doc = docs[0]; | ||
| ReactDOM.render(<Doc />, document.getElementById('root')); | ||
| if (!root) { | ||
| root = createRoot(document.getElementById('root')!); | ||
| } | ||
| root.render(<Doc />); | ||
|
Comment on lines
+4
to
+11
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,17 @@ | ||
| import React from 'react'; | ||
| import ReactDOM from 'react-dom'; | ||
| import { createRoot } from 'react-dom/client'; | ||
| import type { RenderingContext } from '@teambit/preview'; | ||
|
|
||
| import { CompositionsApp } from './compositions-app'; | ||
|
|
||
| let root; | ||
|
|
||
| /** | ||
| * mounts compositions into the DOM in the component preview. | ||
| */ | ||
| export default (Composition: React.ComponentType, previewContext: RenderingContext) => { | ||
| ReactDOM.render( | ||
| <CompositionsApp Composition={Composition} previewContext={previewContext} />, | ||
| document.getElementById('root') | ||
| ); | ||
| if (!root) { | ||
| root = createRoot(document.getElementById('root')!); | ||
| } | ||
| root.render(<CompositionsApp Composition={Composition} previewContext={previewContext} />); | ||
|
Comment on lines
+7
to
+16
|
||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,16 @@ | ||
| import type { DocsRootProps } from '@teambit/docs'; | ||
| import React from 'react'; | ||
| import ReactDOM from 'react-dom'; | ||
| import { createRoot } from 'react-dom/client'; | ||
|
|
||
| import { DocsApp } from './docs-app'; | ||
|
|
||
| let root; | ||
|
|
||
| function DocsRoot({ componentId, docs, compositions, context }: DocsRootProps) { | ||
| ReactDOM.render( | ||
| <DocsApp componentId={componentId} docs={docs} compositions={compositions} context={context} />, | ||
| document.getElementById('root') | ||
| ); | ||
| if (!root) { | ||
| root = createRoot(document.getElementById('root')!); | ||
| } | ||
| root.render(<DocsApp componentId={componentId} docs={docs} compositions={compositions} context={context} />); | ||
|
Comment on lines
+7
to
+13
|
||
| } | ||
|
|
||
| // For backward compatibility - can be removed end of 2022 | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -49,7 +49,7 @@ | |||||||
| "@mdx-js/mdx": "^3.1.1", | ||||||||
| "@mdx-js/react": "1.6.22", | ||||||||
| "@modelcontextprotocol/sdk": "^1.22.0", | ||||||||
| "@monaco-editor/react": "4.4.6", | ||||||||
| "@monaco-editor/react": "4.7.0", | ||||||||
| "@parcel/watcher": "^2.5.1", | ||||||||
| "@pmmmwh/react-refresh-webpack-plugin": "0.5.4", | ||||||||
| "@pnpm/client": "1001.1.24", | ||||||||
|
|
@@ -314,7 +314,6 @@ | |||||||
| "@teambit/react.instructions.react.adding-compositions": "0.0.7", | ||||||||
| "@teambit/react.instructions.react.adding-tests": "0.0.6", | ||||||||
| "@teambit/react.jest.react-jest": "^1.0.37", | ||||||||
|
||||||||
| "@teambit/react.jest.react-jest": "^1.0.37", | |
| "@teambit/react.jest.react-jest": "^1.0.37", | |
| "@teambit/react.rendering.ssr": "^1.0.0", |
Copilot
AI
Apr 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@types/express was changed from an exact version to a caret range, while most @types/* dependencies in this file are pinned. This can lead to unexpected type changes on reinstall/CI. Consider pinning an exact version (or apply the same range strategy consistently across types).
| "@types/express": "^4.17.21", | |
| "@types/express": "4.17.21", |
Copilot
AI
Apr 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most dependencies in this policy are pinned to exact versions, but express was changed to a caret range (and effectively downgraded from 4.21.2 to ^4.21.0). This reduces reproducibility and can introduce untested minor/patch behavior changes. Consider keeping the exact version pin unless there’s a specific need for a range.
| "express": "^4.21.0", | |
| "express": "4.21.2", |
Copilot
AI
Apr 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
React/ReactDOM peers are updated to 19.1.0 here, but the SSR app build policy in scopes/react/react/apps/web/react.application.ts#getSsrPolicy() is still pinning react/react-dom to 17.0.2. That will produce SSR bundles running a different React major than the rest of the workspace. Update the SSR policy to React 19 (or document why SSR must remain on 17).
Uh oh!
There was an error while loading. Please reload this page.