mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-19 02:12:10 +08:00
fix: remove dead localStorage writes and hardcoded key
- Remove unused `dns_settings_enabled` localStorage writes in setting-clash.tsx — state is sourced from verge config, these writes were never read anywhere. - Replace hardcoded `'last_check_update'` localStorage read in system-info-card.tsx with exported `readLastCheckTime()` from the useUpdate hook, keeping the key in a single source of truth.
This commit is contained in:
@@ -16,7 +16,7 @@ export interface UpdateInfo {
|
||||
|
||||
const LAST_CHECK_KEY = 'last_check_update'
|
||||
|
||||
const readLastCheckFromStorage = (): number | null => {
|
||||
export const readLastCheckTime = (): number | null => {
|
||||
const stored = localStorage.getItem(LAST_CHECK_KEY)
|
||||
if (!stored) return null
|
||||
const ts = parseInt(stored, 10)
|
||||
@@ -63,14 +63,10 @@ export const useUpdate = (
|
||||
})
|
||||
|
||||
// Shared last check timestamp
|
||||
const { data: lastCheckUpdate } = useSWR(
|
||||
LAST_CHECK_KEY,
|
||||
readLastCheckFromStorage,
|
||||
{
|
||||
revalidateOnFocus: false,
|
||||
revalidateOnReconnect: false,
|
||||
},
|
||||
)
|
||||
const { data: lastCheckUpdate } = useSWR(LAST_CHECK_KEY, readLastCheckTime, {
|
||||
revalidateOnFocus: false,
|
||||
revalidateOnReconnect: false,
|
||||
})
|
||||
|
||||
return {
|
||||
updateInfo,
|
||||
|
||||
Reference in New Issue
Block a user