refactor: reduce duplicated separately useSWR (#6153)

* refactor: reduce duplicated seperatlly useSWR

* refactor: streamline useSWR integration and improve error handling
This commit is contained in:
Tunglies
2026-01-25 07:14:45 +00:00
committed by GitHub
parent bf189bb144
commit c7462716e5
5 changed files with 25 additions and 34 deletions
+11 -4
View File
@@ -1,4 +1,12 @@
import { useSWRConfig } from "swr";
const SWR_NOT_SMART = {
revalidateOnFocus: false,
revalidateOnReconnect: false,
revalidateIfStale: false,
suspense: false,
errorRetryCount: 2,
dedupingInterval: 1500,
errorRetryInterval: 3000,
} as const;
export const SWR_DEFAULTS = {
revalidateOnFocus: false,
@@ -19,7 +27,6 @@ export const SWR_SLOW_POLL = {
refreshInterval: 60000,
} as const;
export const useSWRMutate = () => {
const { mutate } = useSWRConfig();
return mutate;
export const SWR_MIHOMO = {
...SWR_NOT_SMART,
};