File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import ReactDOM from "react-dom" ;
2- import RedBox from "redbox-react" ;
3- import React from "react" ;
1+ import { createRoot } from "react-dom/client" ;
2+ import { flushSync } from "react-dom" ;
43import Variables from "../Styles/variables.scss" ;
54import UI from "./UserInterface" ;
65
76export default function renderUi ( terria , allBaseMaps , viewState ) {
8- let render = ( ) => {
9- ReactDOM . render (
7+ const container = document . getElementById ( "ui" ) ;
8+ const root = createRoot ( container ) ;
9+
10+ // Ensure that the initial render is synchronous so there is no a white flash visible between loading and rendering
11+ flushSync ( ( ) =>
12+ root . render (
1013 < UI
1114 terria = { terria }
1215 allBaseMaps = { allBaseMaps }
1316 viewState = { viewState }
1417 themeOverrides = { Variables }
15- /> ,
16- document . getElementById ( "ui" )
17- ) ;
18- } ;
19-
20- if ( module . hot && process . env . NODE_ENV !== "production" ) {
21- // Support hot reloading of components
22- // and display an overlay for runtime errors
23- const renderApp = render ;
24- const renderError = ( error ) => {
25- console . error ( error ) ;
26- console . error ( error . stack ) ;
27- ReactDOM . render ( < RedBox error = { error } /> , document . getElementById ( "ui" ) ) ;
28- } ;
29- render = ( ) => {
30- try {
31- renderApp ( ) ;
32- } catch ( error ) {
33- renderError ( error ) ;
34- }
35- } ;
36- module . hot . accept ( "./UserInterface" , ( ) => {
37- setTimeout ( render ) ;
38- } ) ;
39- }
40-
41- render ( ) ;
18+ />
19+ )
20+ ) ;
4221}
Original file line number Diff line number Diff line change 3434 },
3535 "resolutions" : {
3636 "underscore" : " ^1.12.1" ,
37- "@types/react" : " ^17.0.3" ,
37+ "@types/react" : " ^18.3.3" ,
38+ "@types/react-dom" : " ^18.3.1" ,
3839 "@types/lodash" : " 4.14.182" ,
3940 "@types/css-font-loading-module" : " ^0.0.13" ,
4041 "@types/node" : " ^22.13.1"
6768 "prettier" : " 2.7.1" ,
6869 "pretty-quick" : " ^4.0.0" ,
6970 "prop-types" : " ^15.6.0" ,
70- "react" : " ^16.14.0" ,
71- "react-dom" : " ^16.14.0" ,
72- "redbox-react" : " ^1.3.6" ,
71+ "react" : " ^18.3.1" ,
72+ "react-dom" : " ^18.3.1" ,
7373 "resolve-url-loader" : " ^5.0.0" ,
7474 "sass" : " ^1.81.0" ,
7575 "sass-loader" : " ^16.0.3" ,
7676 "style-loader" : " ^4.0.0" ,
7777 "svg-sprite-loader" : " ^6.0.11" ,
78- "terriajs" : " 8.9.5 " ,
78+ "terriajs" : " 8.10.0 " ,
7979 "terriajs-cesium" : " 8.0.2" ,
8080 "terriajs-plugin-api" : " 0.0.1-alpha.17" ,
8181 "terriajs-plugin-sample" : " 0.0.1-alpha.7" ,
You can’t perform that action at this time.
0 commit comments