fix(events): close run-state race and restore single error toasts

Self-review findings: the bus now re-reads the run-state snapshot in
onSubscribed so an event racing the store's initial read cannot leave a
stale snapshot (the ordering the old layout listener guaranteed), and the
patch hooks pass errorNotice:false so GuardState/page handlers remain the
only error toast, matching the pre-migration behavior.
This commit is contained in:
Tunglies
2026-10-01 14:34:17 +08:00
committed by GitHub
parent 70d1298bc9
commit 1552f8e2f9
6 changed files with 20 additions and 1 deletions
+2
View File
@@ -108,6 +108,7 @@ export const useClash = () => {
await mutate(() => patchClashConfig(patch), {
id: 'patch-clash-config',
revalidate: [['getRuntimeConfig']],
errorNotice: false,
})
})
@@ -138,6 +139,7 @@ export const useClashInfo = () => {
await mutate(() => patchClashConfig(patch), {
id: 'patch-clash-info',
revalidate: [['getClashInfo'], ['getClashConfig']],
errorNotice: false,
})
})
+3
View File
@@ -39,10 +39,13 @@ export const useVerge = () => {
)
}
// Callers own the error toast (GuardState onCatch / page onError), so the
// funnel must not add a second one.
const patchVerge = useCallback(async (value: Partial<IVergeConfig>) => {
await mutate(() => patchVergeConfig(value), {
id: 'patch-verge-config',
revalidate: [['getVergeConfig']],
errorNotice: false,
})
}, [])