about summary refs log tree commit diff
path: root/src/lib/react-query.tsx
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-04-04 18:57:38 +0100
committerGitHub <noreply@github.com>2024-04-04 18:57:38 +0100
commitb783745b2e4c1b4c3b55892ba05280808e5b370d (patch)
tree5c3fc20b51496d32934d250186c249de9bf7f515 /src/lib/react-query.tsx
parentb26abf212efc0e50bf85a74d15bf7b5ce350cf5a (diff)
downloadvoidsky-b783745b2e4c1b4c3b55892ba05280808e5b370d.tar.zst
Extract query key roots to constants (#3404)
* Extract query key roots to constants

* Dedupe labelers-detailed-info

* Align naming
Diffstat (limited to 'src/lib/react-query.tsx')
-rw-r--r--src/lib/react-query.tsx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/react-query.tsx b/src/lib/react-query.tsx
index 2fcd46942..be507216a 100644
--- a/src/lib/react-query.tsx
+++ b/src/lib/react-query.tsx
@@ -11,7 +11,8 @@ import {
 import {isNative} from '#/platform/detection'
 
 // any query keys in this array will be persisted to AsyncStorage
-const STORED_CACHE_QUERY_KEYS = ['labelers-detailed-info']
+export const labelersDetailedInfoQueryKeyRoot = 'labelers-detailed-info'
+const STORED_CACHE_QUERY_KEY_ROOTS = [labelersDetailedInfoQueryKeyRoot]
 
 focusManager.setEventListener(onFocus => {
   if (isNative) {
@@ -65,7 +66,7 @@ const dehydrateOptions: PersistQueryClientProviderProps['persistOptions']['dehyd
   {
     shouldDehydrateMutation: (_: any) => false,
     shouldDehydrateQuery: query => {
-      return STORED_CACHE_QUERY_KEYS.includes(String(query.queryKey[0]))
+      return STORED_CACHE_QUERY_KEY_ROOTS.includes(String(query.queryKey[0]))
     },
   }