fix: handle frozen page lifecycle state (#1658)
This commit is contained in:
parent
f7a8d471a6
commit
32cfe6371f
10 changed files with 134 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
import type { MaybeComputedRef, RemovableRef } from '@vueuse/core'
|
||||
import type { Ref } from 'vue'
|
||||
import { del, get, set, update } from 'idb-keyval'
|
||||
import type { UseIDBOptions } from '@vueuse/integrations/useIDBKeyval'
|
||||
import { del, get, set, update } from '~/utils/elk-idb'
|
||||
|
||||
const isIDBSupported = !process.test && typeof indexedDB !== 'undefined'
|
||||
|
||||
|
|
|
@ -106,6 +106,9 @@ export function useStreaming(
|
|||
stream.value = cb(client.value)
|
||||
})
|
||||
|
||||
if (process.client && !process.test)
|
||||
useNuxtApp().$pageLifecycle.addFrozenListener(cleanup)
|
||||
|
||||
tryOnBeforeUnmount(() => isActive.value = false)
|
||||
|
||||
if (controls)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue