about summary refs log tree commit diff
path: root/src/lib/react-query.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/react-query.ts')
-rw-r--r--src/lib/react-query.ts21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/lib/react-query.ts b/src/lib/react-query.ts
index 2a8f1d759..6ec620f74 100644
--- a/src/lib/react-query.ts
+++ b/src/lib/react-query.ts
@@ -1,3 +1,22 @@
 import {QueryClient} from '@tanstack/react-query'
 
-export const queryClient = new QueryClient()
+export const queryClient = new QueryClient({
+  defaultOptions: {
+    queries: {
+      // NOTE
+      // refetchOnWindowFocus breaks some UIs (like feeds)
+      // so we NEVER want to enable this
+      // -prf
+      refetchOnWindowFocus: false,
+      // Structural sharing between responses makes it impossible to rely on
+      // "first seen" timestamps on objects to determine if they're fresh.
+      // Disable this optimization so that we can rely on "first seen" timestamps.
+      structuralSharing: false,
+      // We don't want to retry queries by default, because in most cases we
+      // want to fail early and show a response to the user. There are
+      // exceptions, and those can be made on a per-query basis. For others, we
+      // should give users controls to retry.
+      retry: false,
+    },
+  },
+})