mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 07:28:37 +08:00
address review comments for useVersionChecker
- Simplify props passing for VersionUpdateToast - Remove redundant removeEventListener call
This commit is contained in:
@@ -78,11 +78,8 @@ export function useVersionChecker() {
|
|||||||
isUpdateToastShown = true
|
isUpdateToastShown = true
|
||||||
const component = h(VersionUpdateToast, {
|
const component = h(VersionUpdateToast, {
|
||||||
message,
|
message,
|
||||||
...(refreshText &&
|
refreshText,
|
||||||
onRefresh && {
|
onRefresh,
|
||||||
refreshText,
|
|
||||||
onRefresh,
|
|
||||||
}),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
toast.info(component, {
|
toast.info(component, {
|
||||||
@@ -146,9 +143,6 @@ export function useVersionChecker() {
|
|||||||
// 等待检查完成
|
// 等待检查完成
|
||||||
await registration.update()
|
await registration.update()
|
||||||
|
|
||||||
// 移除监听器
|
|
||||||
registration.removeEventListener('updatefound', onUpdateFound)
|
|
||||||
|
|
||||||
// 检查是否有更新正在进行
|
// 检查是否有更新正在进行
|
||||||
// 如果发现更新,或者正在安装/等待中,则直接返回(交由 SW activated 事件处理)
|
// 如果发现更新,或者正在安装/等待中,则直接返回(交由 SW activated 事件处理)
|
||||||
if (updateFound || registration.installing || registration.waiting) {
|
if (updateFound || registration.installing || registration.waiting) {
|
||||||
|
|||||||
Reference in New Issue
Block a user