This commit is contained in:
Violet Caulfield
2025-03-26 06:39:56 -05:00
parent 7096a72a69
commit 46a1f8737d
2 changed files with 19 additions and 2 deletions

15
App.tsx
View File

@@ -15,6 +15,7 @@ import { createWorkletRuntime } from 'react-native-reanimated';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { NavigationContainer } from '@react-navigation/native';
import { JellifyDarkTheme, JellifyLightTheme } from './components/theme';
import uuid from "react-native-uuid"
export const backgroundRuntime = createWorkletRuntime('background');
@@ -58,8 +59,20 @@ export default function App(): React.JSX.Element {
<PersistQueryClientProvider
client={queryClient}
persistOptions={{
/**
* Bust old data in favor of newer
* data
*/
buster: uuid.v4(),
persister: clientPersister,
maxAge: (1000 * 60 * 60) * 1 // 1 hour
/**
* Infinity, since data can remain the
* same forever on the server
*/
maxAge: Infinity
}}>
<GestureHandlerRootView>
<TamaguiProvider config={jellifyConfig}>

View File

@@ -14,7 +14,11 @@ import { QueryClient } from "@tanstack/react-query";
export const queryClient = new QueryClient({
defaultOptions: {
queries: {
gcTime: (1000 * 60 * 60) * 3, // 3 hours
/**
* Infinity, this needs to be greater than
* or higher than the `maxAge`
*/
gcTime: Infinity,
staleTime: (1000 * 60 * 60) * 1 // 1 hour, users can manually refresh stuff too!
}
}