fix: delay PWA update checks on visibilitychange/online events to allow network stack stabilization
This commit is contained in:
@@ -42,12 +42,14 @@ function scheduleUpdateChecks(
|
|||||||
|
|
||||||
const onVisibilityChange = () => {
|
const onVisibilityChange = () => {
|
||||||
if (document.visibilityState === 'visible') {
|
if (document.visibilityState === 'visible') {
|
||||||
checkForUpdate()
|
// Delay check on wake-up to allow the mobile network stack to stabilize
|
||||||
|
setTimeout(checkForUpdate, 2000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const onOnline = () => {
|
const onOnline = () => {
|
||||||
checkForUpdate()
|
// Small delay to ensure connection is fully established
|
||||||
|
setTimeout(checkForUpdate, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('visibilitychange', onVisibilityChange)
|
document.addEventListener('visibilitychange', onVisibilityChange)
|
||||||
|
|||||||
Reference in New Issue
Block a user