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

DevTools imports #24163

Merged
merged 2 commits into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 1 addition & 4 deletions packages/react-devtools-core/src/standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
*/

import {createElement} from 'react';
import {
// $FlowFixMe Flow does not yet know about flushSync()
flushSync,
} from 'react-dom';
import {flushSync} from 'react-dom';
import {createRoot} from 'react-dom/client';
import Bridge from 'react-devtools-shared/src/bridge';
import Store from 'react-devtools-shared/src/devtools/store';
Expand Down
3 changes: 2 additions & 1 deletion packages/react-devtools-extensions/src/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* global chrome */

import {createElement} from 'react';
import {createRoot, flushSync} from 'react-dom';
import {flushSync} from 'react-dom';
import {createRoot} from 'react-dom/client';
import Bridge from 'react-devtools-shared/src/bridge';
import Store from 'react-devtools-shared/src/devtools/store';
import {getBrowserName, getBrowserTheme} from './utils';
Expand Down
4 changes: 2 additions & 2 deletions packages/react-devtools-shell/src/app/Iframe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import * as React from 'react';
import {Fragment} from 'react';
import * as ReactDOM from 'react-dom';
import {createPortal} from 'react-dom';

export default function Iframe() {
return (
Expand Down Expand Up @@ -56,7 +56,7 @@ function Frame(props) {
style={iframeStyle}
/>

{element ? ReactDOM.createPortal(props.children, element) : null}
{element ? createPortal(props.children, element) : null}
</Fragment>
);
}
Expand Down
3 changes: 1 addition & 2 deletions packages/react-devtools-shell/src/app/devtools.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/** @flow */

import {createElement} from 'react';
// $FlowFixMe Flow does not yet know about createRoot()
import {createRoot} from 'react-dom';
import {createRoot} from 'react-dom/client';
import {
activate as activateBackend,
initialize as initializeBackend,
Expand Down
1 change: 1 addition & 0 deletions packages/react-devtools-shell/src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ignoreErrors([
'Warning: Legacy context API',
'Warning: Unsafe lifecycle methods',
'Warning: %s is deprecated in StrictMode.', // findDOMNode
'Warning: ReactDOM.render is no longer supported in React 18',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's okay to ignore this in the DevTools test harness. We intentionally use legacy render so that we can integration-test it. Once it's (eventually) removed, we'll remove it too in DevTools. (Or we'll add a legacy version of React to the test harness.)

]);
ignoreWarnings(['Warning: componentWillReceiveProps has been renamed']);
ignoreLogs([]);
Expand Down
4 changes: 2 additions & 2 deletions packages/react-devtools-shell/src/e2e/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as ReactDOMClient from 'react-dom/client';
import {createRoot} from 'react-dom/client';

const container = document.createElement('div');

Expand All @@ -14,7 +14,7 @@ const container = document.createElement('div');
// so that it can load things other than just ToDoList.
const App = require('./apps/ListApp').default;

const root = ReactDOMClient.createRoot(container);
const root = createRoot(container);
root.render(<App />);

// ReactDOM Test Selector APIs used by Playwright e2e tests
Expand Down
4 changes: 2 additions & 2 deletions packages/react-devtools-shell/src/e2e/devtools.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as ReactDOMClient from 'react-dom/client';
import {createRoot} from 'react-dom/client';
import {
activate as activateBackend,
initialize as initializeBackend,
Expand Down Expand Up @@ -34,7 +34,7 @@ function init(appIframe, devtoolsContainer, appSource) {

inject(contentDocument, appSource, () => {
// $FlowFixMe Flow doesn't know about createRoot() yet.
ReactDOMClient.createRoot(devtoolsContainer).render(
createRoot(devtoolsContainer).render(
<DevTools
hookNamesModuleLoaderFunction={hookNamesModuleLoaderFunction}
showTabBar={true}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-devtools-shell/src/multi/devtools.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import {createRoot} from 'react-dom';
import {createRoot} from 'react-dom/client';
import {
activate as activateBackend,
createBridge as createBackendBridge,
Expand Down