mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-09 03:42:06 +08:00
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:
@@ -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,
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
}, [])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user