Merge pull request #673 from robintown/fix-warnings

Switch to the React 18 createRoot API
This commit is contained in:
Robin 2022-10-27 10:05:16 -04:00 committed by GitHub
commit 99b3880afc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

View file

@ -28,6 +28,10 @@ module.exports = {
"plugin:matrix-org/react",
"prettier",
],
rules: {
// We're aiming to convert this code to strict mode
"@typescript-eslint/no-non-null-assertion": "off",
},
},
],
settings: {

View file

@ -20,8 +20,8 @@ limitations under the License.
// dependency references.
import "matrix-js-sdk/src/browser-index";
import React from "react";
import ReactDOM from "react-dom";
import React, { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { createBrowserHistory } from "history";
import * as Sentry from "@sentry/react";
import { Integrations } from "@sentry/tracing";
@ -39,6 +39,8 @@ initRageshake();
console.info(`matrix-video-chat ${import.meta.env.VITE_APP_VERSION || "dev"}`);
const root = createRoot(document.getElementById("root")!);
let fatalError: Error | null = null;
if (!window.isSecureContext) {
@ -52,7 +54,7 @@ if (!window.isSecureContext) {
}
if (fatalError !== null) {
ReactDOM.render(<>fatalError.message</>, document.getElementById("root"));
root.render(fatalError.message);
throw fatalError; // Stop the app early
}
@ -147,9 +149,8 @@ i18n
},
});
ReactDOM.render(
<React.StrictMode>
root.render(
<StrictMode>
<App history={history} />
</React.StrictMode>,
document.getElementById("root")
</StrictMode>
);