Skip to content

Commit bc3550d

Browse files
committed
docs: add comment explaining gcTime in test wrapper
Clarifies that gcTime (renamed from cacheTime in TanStack Query v5) controls inactive query memory retention and why it's set to 0 in tests.
1 parent 6f5713d commit bc3550d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/hooks/wrapper.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ const Wrapper = ({ children }: WrapperType) => {
1010
const testQueryClient = new QueryClient({
1111
defaultOptions: {
1212
queries: {
13+
// gcTime (previously cacheTime in v4) controls how long unused/inactive queries
14+
// remain in memory. Set to 0 in tests to prevent caching between test runs.
1315
gcTime: 0,
1416
staleTime: 0,
1517
retry: false,

0 commit comments

Comments
 (0)