fix(home): unify last check update timestamp across settings and home page (#6605)

The settings page "Check for updates" did not update the homepage
"last check update time" because each page managed the timestamp
independently. Centralizes the timestamp in the useUpdate hook
via SWR + localStorage so both pages share a single data source.

Closes https://github.com/clash-verge-rev/clash-verge-rev/issues/6605#issuecomment-4147144987
This commit is contained in:
Tunglies
2026-03-29 01:56:34 +08:00
parent c3aba3fc79
commit 99bbd7ee5a
3 changed files with 63 additions and 90 deletions
@@ -4,6 +4,7 @@ import { useCallback, useRef } from 'react'
import { useTranslation } from 'react-i18next'
import { DialogRef, TooltipIcon } from '@/components/base'
import { updateLastCheckTime } from '@/hooks/use-update'
import {
exitApp,
exportDiagnosticInfo,
@@ -45,6 +46,7 @@ const SettingVergeAdvanced = ({ onError: _ }: Props) => {
const onCheckUpdate = async () => {
try {
const info = await checkUpdate()
updateLastCheckTime()
if (!info?.available) {
showNotice.success(
'settings.components.verge.advanced.notifications.latestVersion',