- Install @tanstack/react-query v5 + devtools - Create core/query-client.ts with WS-optimized defaults (staleTime: Infinity) - Create QueryProvider and wire into root layout - Add @core/* path alias to tsconfig + vitest - Add useWorkspaceId() bridge hook for query key scoping Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
17 lines
556 B
TypeScript
17 lines
556 B
TypeScript
"use client";
|
|
|
|
import { useState } from "react";
|
|
import { QueryClientProvider } from "@tanstack/react-query";
|
|
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
import { createQueryClient } from "./query-client";
|
|
import type { ReactNode } from "react";
|
|
|
|
export function QueryProvider({ children }: { children: ReactNode }) {
|
|
const [queryClient] = useState(createQueryClient);
|
|
return (
|
|
<QueryClientProvider client={queryClient}>
|
|
{children}
|
|
<ReactQueryDevtools initialIsOpen={false} />
|
|
</QueryClientProvider>
|
|
);
|
|
}
|