This repository has been archived on 2026-09-13. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
BPOS-TMP-REPO/apps/web/src/app/query.ts
T

20 lines
574 B
TypeScript

/**
* 服务端状态 —— TanStack Query(编码规范 §1 / §9.2)。
* 「SSE 事件到达 → 按信封目标失效对应缓存,由订阅层统一做;组件禁止自行轮询或手写缓存。」
*/
import { QueryClient } from '@tanstack/react-query';
import { queryKeys } from '@web-shared/query-keys.ts';
export { queryKeys };
export const queryClient = new QueryClient({
defaultOptions: {
queries: {
// 缓存失效由 SSE 订阅层驱动,不靠组件轮询
refetchOnWindowFocus: false,
retry: 1,
staleTime: 5_000,
},
},
});