File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
src/components/common/hooks/useVersionUpdate Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ export const useVersionUpdateReload = ({ toastEligibleRoutes }: VersionUpdatePro
127
127
128
128
const handleAppUpdate = ( ) => {
129
129
dismissToast ( { updateToastRef } )
130
-
130
+ refreshing . current = true
131
131
// eslint-disable-next-line @typescript-eslint/no-floating-promises
132
132
updateServiceWorker ( true )
133
133
}
@@ -149,7 +149,6 @@ export const useVersionUpdateReload = ({ toastEligibleRoutes }: VersionUpdatePro
149
149
if ( ! bgUpdated ) {
150
150
return
151
151
}
152
- dismissToast ( { updateToastRef } )
153
152
if ( toastEligibleRoutesMap [ location . pathname ] ) {
154
153
updateToastRef . current = ToastManager . showToast (
155
154
{
@@ -170,7 +169,7 @@ export const useVersionUpdateReload = ({ toastEligibleRoutes }: VersionUpdatePro
170
169
} ,
171
170
)
172
171
}
173
- } , [ bgUpdated , location ] )
172
+ } , [ bgUpdated ] )
174
173
175
174
// Sync local state with the service worker's needRefresh state
176
175
useEffect ( ( ) => {
@@ -198,9 +197,7 @@ export const useVersionUpdateReload = ({ toastEligibleRoutes }: VersionUpdatePro
198
197
. getRegistrations ( )
199
198
. then ( ( registrations ) => registrations . forEach ( ( reg ) => reg . update ( ) ) )
200
199
if ( doesNeedRefresh && ! refreshing . current ) {
201
- handleNeedRefresh ( updateServiceWorker )
202
- } else if ( bgUpdated ) {
203
- dismissToast ( { updateToastRef } )
200
+ handleAppUpdate ( )
204
201
}
205
202
}
206
203
} , [ location ] )
You can’t perform that action at this time.
0 commit comments