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

View File

@@ -78,11 +78,8 @@ export function useVersionChecker() {
isUpdateToastShown = true
const component = h(VersionUpdateToast, {
message,
...(refreshText &&
onRefresh && {
refreshText,
onRefresh,
}),
refreshText,
onRefresh,
})
toast.info(component, {
@@ -146,9 +143,6 @@ export function useVersionChecker() {
// 等待检查完成
await registration.update()
// 移除监听器
registration.removeEventListener('updatefound', onUpdateFound)
// 检查是否有更新正在进行
// 如果发现更新,或者正在安装/等待中,则直接返回(交由 SW activated 事件处理)
if (updateFound || registration.installing || registration.waiting) {