A realtime multiplayer version of the boardgame Ricochet Robots
at master 25 lines 684 B view raw
1import { 2 defaultShouldDehydrateQuery, 3 QueryClient, 4} from "@tanstack/react-query"; 5import SuperJSON from "superjson"; 6 7export const createQueryClient = () => 8 new QueryClient({ 9 defaultOptions: { 10 queries: { 11 // With SSR, we usually want to set some default staleTime 12 // above 0 to avoid refetching immediately on the client 13 staleTime: 30 * 1000, 14 }, 15 dehydrate: { 16 serializeData: SuperJSON.serialize, 17 shouldDehydrateQuery: (query) => 18 defaultShouldDehydrateQuery(query) || 19 query.state.status === "pending", 20 }, 21 hydrate: { 22 deserializeData: SuperJSON.deserialize, 23 }, 24 }, 25 });