File tree Expand file tree Collapse file tree 9 files changed +47
-40
lines changed
Expand file tree Collapse file tree 9 files changed +47
-40
lines changed Original file line number Diff line number Diff line change 332332 "mousetrap" : " ^1.6.3" ,
333333 "pikaday" : " ^1.8.0" ,
334334 "query-string" : " 5.1.1" ,
335- "react" : " ^17 .0.1 || ^18 .0.0" ,
335+ "react" : " ^18 .0.0 || ^19 .0.0" ,
336336 "react-animate-height" : " ^3.2.3" ,
337337 "react-aria-components" : " ^1.10.1" ,
338338 "react-beautiful-dnd" : " ^13.1.1" ,
339- "react-dom" : " ^17 .0.1 || ^18 .0.0" ,
339+ "react-dom" : " ^18 .0.0 || ^19 .0.0" ,
340340 "react-draggable" : " ^4.5.0" ,
341341 "react-immutable-proptypes" : " ^2.1.0" ,
342342 "react-intl" : " >=2.9.0" ,
Original file line number Diff line number Diff line change 55 */
66
77import * as React from 'react' ;
8- // TODO switch to createRoot when upgrading to React 18
9- // eslint-disable-next-line react/no-deprecated
10- import { render } from 'react-dom' ;
8+ import { createRoot } from 'react-dom/client' ;
119import ES6Wrapper from './ES6Wrapper' ;
1210// $FlowFixMe
1311import ContentExplorerReactComponent from '../content-explorer' ;
@@ -103,7 +101,10 @@ class ContentExplorer extends ES6Wrapper {
103101
104102 /** @inheritdoc */
105103 render ( ) {
106- render (
104+ if ( ! this . root ) {
105+ this . root = createRoot ( this . container ) ;
106+ }
107+ this . root . render (
107108 < ContentExplorerReactComponent
108109 language = { this . language }
109110 messages = { this . messages }
@@ -121,7 +122,6 @@ class ContentExplorer extends ES6Wrapper {
121122 onInteraction = { this . onInteraction }
122123 { ...this . options }
123124 /> ,
124- this . container ,
125125 ) ;
126126 }
127127}
Original file line number Diff line number Diff line change 66
77import 'regenerator-runtime/runtime' ;
88import * as React from 'react' ;
9- // TODO switch to createRoot when upgrading to React 18
10- // eslint-disable-next-line react/no-deprecated
11- import { render } from 'react-dom' ;
9+ import { createRoot } from 'react-dom/client' ;
1210import ES6Wrapper from './ES6Wrapper' ;
1311import ContentOpenWithReactComponent from '../content-open-with' ;
1412
@@ -33,7 +31,10 @@ class ContentOpenWith extends ES6Wrapper {
3331
3432 /** @inheritdoc */
3533 render ( ) {
36- render (
34+ if ( ! this . root ) {
35+ this . root = createRoot ( this . container ) ;
36+ }
37+ this . root . render (
3738 < ContentOpenWithReactComponent
3839 componentRef = { this . setComponent }
3940 fileId = { this . id }
@@ -45,7 +46,6 @@ class ContentOpenWith extends ES6Wrapper {
4546 token = { this . token }
4647 { ...this . options }
4748 /> ,
48- this . container ,
4949 ) ;
5050 }
5151}
Original file line number Diff line number Diff line change 55 */
66
77import * as React from 'react' ;
8- // TODO switch to createRoot when upgrading to React 18
9- // eslint-disable-next-line react/no-deprecated
10- import { render } from 'react-dom' ;
8+ import { createRoot } from 'react-dom/client' ;
119import ES6Wrapper from './ES6Wrapper' ;
1210import ContentPickerPopup from '../content-picker/ContentPickerPopup' ;
1311import ContentPickerReactComponent from '../content-picker/ContentPicker' ;
@@ -58,7 +56,10 @@ class ContentPicker extends ES6Wrapper {
5856 render ( ) {
5957 const { modal, ...rest } : { modal ?: ModalOptions } = this . options ;
6058 const PickerComponent = modal ? ContentPickerPopup : ContentPickerReactComponent ;
61- render (
59+ if ( ! this . root ) {
60+ this . root = createRoot ( this . container ) ;
61+ }
62+ this . root . render (
6263 < PickerComponent
6364 clientName = { this . getClientName ( ) }
6465 componentRef = { this . setComponent }
@@ -72,7 +73,6 @@ class ContentPicker extends ES6Wrapper {
7273 type = { this . getType ( ) }
7374 { ...rest }
7475 /> ,
75- this . container ,
7676 ) ;
7777 }
7878}
Original file line number Diff line number Diff line change 55 */
66
77import * as React from 'react' ;
8- // TODO switch to createRoot when upgrading to React 18
9- // eslint-disable-next-line react/no-deprecated
10- import { render } from 'react-dom' ;
8+ import { createRoot } from 'react-dom/client' ;
119import ES6Wrapper from './ES6Wrapper' ;
1210import ContentPreviewResponsive from '../content-preview' ;
1311
@@ -22,7 +20,10 @@ class ContentPreview extends ES6Wrapper {
2220
2321 /** @inheritdoc */
2422 render ( ) {
25- render (
23+ if ( ! this . root ) {
24+ this . root = createRoot ( this . container ) ;
25+ }
26+ this . root . render (
2627 < ContentPreviewResponsive
2728 componentRef = { this . setComponent }
2829 fileId = { this . id }
@@ -32,7 +33,6 @@ class ContentPreview extends ES6Wrapper {
3233 token = { this . token }
3334 { ...this . options }
3435 /> ,
35- this . container ,
3636 ) ;
3737 }
3838}
Original file line number Diff line number Diff line change 66
77import * as React from 'react' ;
88import uniqueId from 'lodash/uniqueId' ;
9- // TODO switch to createRoot when upgrading to React 18
10- // eslint-disable-next-line react/no-deprecated
11- import { render } from 'react-dom' ;
9+ import { createRoot } from 'react-dom/client' ;
1210import ES6Wrapper from './ES6Wrapper' ;
1311import ContentSharingReactComponent from '../content-sharing' ;
1412import { ITEM_TYPE_FILE } from '../../common/constants' ;
@@ -19,7 +17,10 @@ class ContentSharing extends ES6Wrapper {
1917 render ( ) {
2018 const { itemType } : { itemType ?: ItemType } = this . options ;
2119
22- render (
20+ if ( ! this . root ) {
21+ this . root = createRoot ( this . container ) ;
22+ }
23+ this . root . render (
2324 < ContentSharingReactComponent
2425 itemID = { this . id }
2526 itemType = { itemType || ITEM_TYPE_FILE }
@@ -29,7 +30,6 @@ class ContentSharing extends ES6Wrapper {
2930 uuid = { uniqueId ( 'contentSharing_' ) }
3031 { ...this . options }
3132 /> ,
32- this . container ,
3333 ) ;
3434 }
3535}
Original file line number Diff line number Diff line change 55 */
66
77import * as React from 'react' ;
8- // TODO switch to createRoot when upgrading to React 18
9- // eslint-disable-next-line react/no-deprecated
10- import { render } from 'react-dom' ;
8+ import { createRoot } from 'react-dom/client' ;
119import ES6Wrapper from './ES6Wrapper' ;
1210import ContentSidebarComponent from '../content-sidebar' ;
1311
@@ -22,7 +20,10 @@ class ContentSidebar extends ES6Wrapper {
2220
2321 /** @inheritdoc */
2422 render ( ) {
25- render (
23+ if ( ! this . root ) {
24+ this . root = createRoot ( this . container ) ;
25+ }
26+ this . root . render (
2627 < ContentSidebarComponent
2728 componentRef = { this . setComponent }
2829 fileId = { this . id }
@@ -32,7 +33,6 @@ class ContentSidebar extends ES6Wrapper {
3233 token = { this . token }
3334 { ...this . options }
3435 /> ,
35- this . container ,
3636 ) ;
3737 }
3838}
Original file line number Diff line number Diff line change 55 */
66
77import * as React from 'react' ;
8- // TODO switch to createRoot when upgrading to React 18
9- // eslint-disable-next-line react/no-deprecated
10- import { render } from 'react-dom' ;
8+ import { createRoot } from 'react-dom/client' ;
119import ES6Wrapper from './ES6Wrapper' ;
1210// $FlowFixMe
1311import ContentUploaderPopup from '../content-uploader/ContentUploaderPopup' ;
@@ -72,7 +70,10 @@ class ContentUploader extends ES6Wrapper {
7270 const { modal, ...rest } : { modal ?: ModalOptions } = this . options ;
7371 const UploaderComponent = modal ? ContentUploaderPopup : WrappedContentUploaderComponent ;
7472
75- render (
73+ if ( ! this . root ) {
74+ this . root = createRoot ( this . container ) ;
75+ }
76+ this . root . render (
7677 < UploaderComponent
7778 language = { this . language }
7879 messages = { this . messages }
@@ -87,7 +88,6 @@ class ContentUploader extends ES6Wrapper {
8788 modal = { ( ( modal : any ) : ModalOptions ) }
8889 { ...rest }
8990 /> ,
90- this . container ,
9191 ) ;
9292 }
9393}
Original file line number Diff line number Diff line change 55 */
66
77import EventEmitter from 'events' ;
8- import ReactDOM from 'react-dom' ;
8+ import type { Root } from 'react-dom/client ' ;
99import i18n from '../common/i18n' ;
1010import { DEFAULT_CONTAINER } from '../../constants' ;
1111import type { Token , StringMap } from '../../common/types/core' ;
@@ -51,6 +51,11 @@ class ES6Wrapper extends EventEmitter {
5151 */
5252 component: any ;
5353
54+ /**
55+ * @property {Root }
56+ */
57+ root: Root ;
58+
5459 /**
5560 * Shows the content picker.
5661 *
@@ -81,8 +86,10 @@ class ES6Wrapper extends EventEmitter {
8186 */
8287 hide ( ) : void {
8388 this . removeAllListeners ( ) ;
84- // eslint-disable-next-line react/no-deprecated
85- ReactDOM . unmountComponentAtNode ( this . container ) ;
89+ if ( this . root ) {
90+ this . root . unmount ( ) ;
91+ this . root = null ;
92+ }
8693 if ( this . container ) {
8794 this . container . innerHTML = '' ;
8895 }
You can’t perform that action at this time.
0 commit comments