Skip to content

Commit 6c9efea

Browse files
committed
Fully switch ReactDOM to v18 mode
1 parent 37f8f0b commit 6c9efea

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ initSentry(process.env.SENTRY_DSN);
1212

1313
import * as _ from 'lodash';
1414
import * as React from 'react';
15-
import * as ReactDOM from 'react-dom';
15+
import * as ReactDOM from 'react-dom/client';
1616
import * as mobx from 'mobx';
1717
import { Provider } from 'mobx-react';
1818

@@ -108,7 +108,8 @@ appStartupPromise.then(() => {
108108
console.log('App started, rendering');
109109

110110
document.dispatchEvent(new Event('load:rendering'));
111-
ReactDOM.render(
111+
const root = ReactDOM.createRoot(document.querySelector(APP_ELEMENT_SELECTOR)!);
112+
root.render(
112113
<Provider {...stores}>
113114
<StyleProvider>
114115
<ErrorBoundary>
@@ -117,7 +118,7 @@ appStartupPromise.then(() => {
117118
</ErrorBoundary>
118119
</StyleProvider>
119120
</Provider>
120-
, document.querySelector(APP_ELEMENT_SELECTOR))
121+
);
121122
});
122123

123124
const STARTUP_TIMEOUT = 10000;

src/util/ui.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ export function useSize(ref: React.RefObject<HTMLElement>, defaultValue: number)
165165

166166
if (container) {
167167
setSpaceAvailable(container.clientWidth);
168-
} else {
169-
logError("Element resized, but no ref available");
170168
}
171169
});
172170

@@ -177,7 +175,7 @@ export function useSize(ref: React.RefObject<HTMLElement>, defaultValue: number)
177175
}
178176

179177
return () => resizeObserver.disconnect();
180-
}, []);
178+
}, [ref]);
181179

182180
return spaceAvailable;
183181
}

0 commit comments

Comments
 (0)