1- import React from 'react' ;
1+ import React , { useEffect } from 'react' ;
22import { MonacoUtils } from '@deephaven/console' ;
33import { DownloadServiceWorkerUtils } from '@deephaven/iris-grid' ;
44import MonacoWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker' ;
@@ -11,25 +11,28 @@ if (import.meta.env.VITE_PLAYWRIGHT_CSS === '1') {
1111}
1212
1313export function AppRoot ( ) : JSX . Element {
14- DownloadServiceWorkerUtils . register (
15- new URL (
16- `${ import . meta. env . BASE_URL ?? '' } download/serviceWorker.js` ,
17- window . location . href
18- )
19- ) ;
20- MonacoUtils . init ( {
21- getWorker : ( id : string , label : string ) => {
22- if ( label === 'json' ) {
23- return new MonacoJsonWorker ( ) ;
24- }
25- return new MonacoWorker ( ) ;
26- } ,
27- } ) ;
14+ useEffect ( function init ( ) {
15+ DownloadServiceWorkerUtils . register (
16+ new URL (
17+ `${ import . meta. env . BASE_URL ?? '' } download/serviceWorker.js` ,
18+ window . location . href
19+ )
20+ ) ;
2821
29- // disable annoying dnd-react warnings
30- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
31- // @ts -ignore
32- window [ '__react-beautiful-dnd-disable-dev-warnings' ] = true ;
22+ MonacoUtils . init ( {
23+ getWorker : ( id : string , label : string ) => {
24+ if ( label === 'json' ) {
25+ return new MonacoJsonWorker ( ) ;
26+ }
27+ return new MonacoWorker ( ) ;
28+ } ,
29+ } ) ;
30+
31+ // disable annoying dnd-react warnings
32+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
33+ // @ts -ignore
34+ window [ '__react-beautiful-dnd-disable-dev-warnings' ] = true ;
35+ } , [ ] ) ;
3336
3437 return < AppRouter /> ;
3538}
0 commit comments