address review comments for useVersionChecker

- Simplify props passing for VersionUpdateToast
- Remove redundant removeEventListener call
This commit is contained in:
PKC278
2026-01-06 15:07:20 +08:00
parent 689e58737b
commit e5749bd6ef
+2 -8
View File
@@ -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) {