Skip to content

Updated React Query cache time in tests to match production - #29292

Merged
EvanHahn merged 1 commit into
mainfrom
claude/flaky-playwright-test-eu5nza
Jul 13, 2026
Merged

Updated React Query cache time in tests to match production#29292
EvanHahn merged 1 commit into
mainfrom
claude/flaky-playwright-test-eu5nza

Conversation

@EvanHahn

@EvanHahn EvanHahn commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

no ref

Why?

Improve CI flakiness.

What?

The acceptance harness built its QueryClient with cacheTime: 0, while production uses 10 minutes.

Setting cacheTime to 0 made a test flaky when it moved between apps (e.g. Network → 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.

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
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The 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)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately summarizes the main change: increasing React Query cache time in tests to match production.
Description check ✅ Passed The description is clearly related to the change and explains the flaky test problem and the cacheTime fix.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/flaky-playwright-test-eu5nza

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Jul 13, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 34f92af

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

@EvanHahn EvanHahn changed the title Increase React Query cache time to 10 minutes in admin app tests Updated React Query cache time in tests to match production Jul 13, 2026
@EvanHahn
EvanHahn requested a review from acburdine July 13, 2026 20:46
@EvanHahn
EvanHahn merged commit 8412acd into main Jul 13, 2026
43 checks passed
@EvanHahn
EvanHahn deleted the claude/flaky-playwright-test-eu5nza branch July 13, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants