File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -161,17 +161,19 @@ export default function App() {
161161
162162 function update ( ) {
163163 updateServiceWorker ( true )
164+ // Trigger page reload
165+ window . location . reload ( )
164166 }
165167
166168 useEffect ( ( ) => {
167169 if ( window . isSecureContext && navigator . serviceWorker ) {
168- // check for sw updates on page change
169- navigator . serviceWorker . getRegistrations ( ) . then ( ( regs ) => regs . forEach ( ( reg ) => reg . update ( ) ) )
170- if ( ! needRefresh ) {
171- return
170+ // check for sw updates on page change
171+ navigator . serviceWorker . getRegistrations ( ) . then ( ( regs ) => regs . forEach ( ( reg ) => reg . update ( ) ) )
172+ if ( ! needRefresh ) {
173+ return
174+ }
175+ update ( )
172176 }
173- update ( )
174- }
175177 } , [ location ] )
176178
177179 function onUpdate ( ) {
You can’t perform that action at this time.
0 commit comments