Updated React Query cache time in tests to match production - #29292
Merged
Conversation
no ref The acceptance harness built its QueryClient with cacheTime: 0, while production uses 10 minutes (admin-x-framework utils/query-client.ts). We build a new client for every render and the afterEach step tears the app down, so test data is never shared between tests regardless of this setting. Setting cacheTime to 0 made a test flaky when it moved between apps (e.g. Network -> back to Posts): some data is shared by both apps, and with cacheTime 0 it gets thrown away and re-fetched during the switch. While it re-loads, the app shows an empty/default value for a moment, which can make an assertion fail. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LPuHn2gsUxGKx2m4z7bnft
Contributor
WalkthroughThe admin acceptance test utility now configures React Query to retain query results for ten minutes. Other QueryClient defaults remain unchanged. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many --target=build --projects=tag:publi... |
✅ Succeeded | <1s | View ↗ |
nx run-many -t test:unit -p @tryghost/admin |
✅ Succeeded | 2m 33s | View ↗ |
nx run @tryghost/admin:build |
✅ Succeeded | 41s | View ↗ |
nx run ghost-monorepo:lint:boundaries |
✅ Succeeded | <1s | View ↗ |
nx run @tryghost/admin:test:acceptance |
✅ Succeeded | 58s | View ↗ |
nx run-many -t lint -p @tryghost/admin |
✅ Succeeded | 38s | View ↗ |
nx run ghost:build:assets |
✅ Succeeded | 2s | View ↗ |
nx run ghost:build:tsc |
✅ Succeeded | 10s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-07-13 20:37:43 UTC
acburdine
approved these changes
Jul 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

no ref
Why?
Improve CI flakiness.
What?
The acceptance harness built its
QueryClientwithcacheTime: 0, while production uses 10 minutes.Setting
cacheTimeto0made a test flaky when it moved between apps (e.g. Network → Posts): some data is shared by both apps, and withcacheTime: 0it gets thrown away and re-fetched during the switch. While it re-loads, the app shows an empty/default value for a moment, which can make an assertion fail.