Skip to content

Commit 2bd8709

Browse files
committed
flush sync root render
1 parent 6f591c4 commit 2bd8709

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

lib/Views/render.jsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { createRoot } from "react-dom/client";
2+
import { flushSync } from "react-dom";
23

34
import Variables from "../Styles/variables.scss";
45
import UI from "./UserInterface";
@@ -7,12 +8,14 @@ export default function renderUi(terria, allBaseMaps, viewState) {
78
const container = document.getElementById("ui");
89
const root = createRoot(container);
910

10-
root.render(
11-
<UI
12-
terria={terria}
13-
allBaseMaps={allBaseMaps}
14-
viewState={viewState}
15-
themeOverrides={Variables}
16-
/>
11+
flushSync(() =>
12+
root.render(
13+
<UI
14+
terria={terria}
15+
allBaseMaps={allBaseMaps}
16+
viewState={viewState}
17+
themeOverrides={Variables}
18+
/>
19+
)
1720
);
1821
}

0 commit comments

Comments
 (0)