Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(swr): prevent useActionSWR isValidating from getting stuck (#12059)

Kingsword8877bc12d76c
diff --git a/src/libs/swr/index.ts b/src/libs/swr/index.ts
index f612d9e3422..099fb9c7244 100644
--- a/src/libs/swr/index.ts
+++ b/src/libs/swr/index.ts
@@ -66,6 +66,10 @@ export const useActionSWR: SWRHook = (key, fetch, config) =>
fallbackData: {},
refreshWhenHidden: false,
refreshWhenOffline: false,
+ // If we disable `revalidateOnMount` but keep `revalidateIfStale` enabled (default true),
+ // SWR can infer `isValidating=true` on subsequent renders while never actually starting a request.
+ // This will lock action buttons in loading state.
+ revalidateIfStale: false,
revalidateOnFocus: false,
revalidateOnMount: false,
revalidateOnReconnect: false,