Skip to content

Commit 9b1dee6

Browse files
committed
Enable React strict mode
This enables React strict mode which will print extra warnings to the console when we use certain constructs incorrectly. This does not affect production builds. See https://beta.reactjs.org/reference/react/StrictMode
1 parent e949b96 commit 9b1dee6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

extensions/ql-vscode/src/view/webview.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from "react";
2+
import { StrictMode } from "react";
23
import { createRoot } from "react-dom/client";
34
import { vscode } from "./vscode-api";
45

@@ -27,10 +28,12 @@ const render = () => {
2728
const view: WebviewDefinition = require(`./${viewName}/index.tsx`).default;
2829

2930
createRoot(element).render(
30-
// Post a message to the extension when fully loaded. See https://github.com/reactwg/react-18/discussions/5 ("What about the render callback?")
31-
<div ref={() => vscode.postMessage({ t: "viewLoaded", viewName })}>
32-
{view.component}
33-
</div>,
31+
<StrictMode>
32+
{/* Post a message to the extension when fully loaded. See https://github.com/reactwg/react-18/discussions/5 ("What about the render callback?")*/}
33+
<div ref={() => vscode.postMessage({ t: "viewLoaded", viewName })}>
34+
{view.component}
35+
</div>
36+
</StrictMode>,
3437
);
3538
};
3639

0 commit comments

Comments
 (0)