From eba08b412fef7f15165cfd1ad638fbf2379f4eed Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Mon, 29 Jun 2026 08:48:19 +0200 Subject: [PATCH] docs(learned-facts): useNetworkAwareQueryClient now Proxy-based The hook was rewritten from Object.create to a Proxy that binds non-invalidateQueries methods to the real client, so removeQueries / setQueryData / getQueriesData work through it now. Update the fact to reflect this (discovered while adding removeQueries to clearAllJellyseerData). Claude-Session: https://claude.ai/code/session_016Hhu5DruGLPhdP4LAoy1Xd --- .../use-network-aware-query-client-limitations.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.claude/learned-facts/use-network-aware-query-client-limitations.md b/.claude/learned-facts/use-network-aware-query-client-limitations.md index 36e8f2d8..eb786e29 100644 --- a/.claude/learned-facts/use-network-aware-query-client-limitations.md +++ b/.claude/learned-facts/use-network-aware-query-client-limitations.md @@ -6,4 +6,6 @@ ## Detail -The `useNetworkAwareQueryClient` hook uses `Object.create(queryClient)` which breaks QueryClient methods that use JavaScript private fields (like `getQueriesData`, `setQueriesData`, `setQueryData`). Only use it when you ONLY need `invalidateQueries`. For cache manipulation, use standard `useQueryClient` from `@tanstack/react-query`. +**Updated 2026-06-29**: This limitation no longer applies. The hook was rewritten to use a `Proxy` (not `Object.create`). It overrides only `invalidateQueries` (network-aware) / `forceInvalidateQueries`, and binds every other method to the real `queryClient` target (`value.bind(target)`). So private-field methods like `getQueriesData`, `setQueryData`, and `removeQueries` work correctly through it now — no need to fall back to a separate `useQueryClient`. (Confirmed when adding `queryClient.removeQueries` to `clearAllJellyseerData` in `hooks/useJellyseerr.ts`.) + +Historical (pre-2026-06): the hook used `Object.create(queryClient)`, which broke methods relying on JavaScript private fields; back then only `invalidateQueries` was safe.