File tree 3 files changed +11
-3
lines changed
3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ export async function initApp() {
27
27
28
28
const container = document . getElementById ( "root" )
29
29
const root = createRoot ( container as HTMLElement )
30
+
30
31
root . render (
31
32
< StrictMode >
32
33
< GlobalStyle />
Original file line number Diff line number Diff line change 1
- import ReactDOM from "react-dom"
1
+ import { createRoot } from "react-dom/client "
2
2
import styled from "styled-components"
3
3
4
4
import { Modal } from "@/components/Modal"
@@ -28,7 +28,11 @@ export const showCacheUpdateModal = () => {
28
28
const updateRoot = document . createElement ( "div" )
29
29
document . body . appendChild ( updateRoot )
30
30
31
- ReactDOM . render (
31
+ const root = createRoot ( updateRoot )
32
+
33
+ console . log ( "Showing service worker modal" )
34
+
35
+ root . render (
32
36
< ThemeProvider >
33
37
< Modal title = "New updates are available" shouldShow >
34
38
< p > Reload the page to see them.</ p >
@@ -47,6 +51,5 @@ export const showCacheUpdateModal = () => {
47
51
</ Buttons >
48
52
</ Modal >
49
53
</ ThemeProvider > ,
50
- updateRoot ,
51
54
)
52
55
}
Original file line number Diff line number Diff line change @@ -16,11 +16,15 @@ export const getMainApp: () => React.FC = () => {
16
16
// could be a disaster
17
17
// Wait for our async chunks to be loaded, then skip waiting phase and show
18
18
// the user a modal informing them that there are new updates available
19
+
20
+ console . log ( "Service worker on update" )
21
+
19
22
Promise . all ( [
20
23
AnalyticsCoreDeferred ,
21
24
LiveRatesCoreDeferred ,
22
25
TradesCoreDeferred ,
23
26
] ) . then ( ( ) => {
27
+ console . log ( "Deferred components resolved, sending skip message" )
24
28
registration . waiting ?. postMessage ( { type : "SKIP_WAITING" } )
25
29
showCacheUpdateModal ( )
26
30
} )
You can’t perform that action at this time.
0 commit comments