Skip to content

test(query-devtools): cover restored custom-hash queries#11055

Open
ckdwns9121 wants to merge 1 commit into
TanStack:mainfrom
ckdwns9121:agent/cover-devtools-custom-query-hash
Open

test(query-devtools): cover restored custom-hash queries#11055
ckdwns9121 wants to merge 1 commit into
TanStack:mainfrom
ckdwns9121:agent/cover-devtools-custom-query-hash

Conversation

@ckdwns9121

@ckdwns9121 ckdwns9121 commented Jul 12, 2026

Copy link
Copy Markdown

Summary

  • add integration coverage for Devtools rendering a hydrated query that uses a per-query custom queryKeyHashFn
  • exercise the complete fetchQuerydehydrate → new client → hydrate → Devtools query-row path
  • guard the direct queryHash cache lookup introduced in Fix devtools query rows with mutable keys #10750

Context

Issue #6958 reported that Devtools stopped displaying persisted queries when one of them used a custom hash function. Devtools previously looked query rows up again by queryKey, which could not reproduce a per-query hash function after hydration.

The runtime lookup was changed to queryCache.get(queryHash) in #10750, but the persistence and custom-hash combination was not covered. This regression test verifies the original failure path end to end and allows #6958 to be closed against the shipped implementation.

Closes #6958.

Validation

  • pnpm --filter @tanstack/query-devtools test:lib --run src/__tests__/Devtools.test.tsx (72 tests)
  • pnpm --filter @tanstack/query-devtools test:lib --run (246 tests)
  • pnpm --filter @tanstack/query-devtools test:eslint
  • pnpm --filter @tanstack/query-devtools test:types:tscurrent
  • pnpm prettier --write packages/query-devtools/src/__tests__/Devtools.test.tsx

Summary by CodeRabbit

  • Tests
    • Added coverage to verify that hydrated queries using custom query-key hashing are displayed correctly in the Devtools query list.

Exercise the full dehydrate, hydrate, and query-row rendering path for a per-query custom queryKeyHashFn. This locks the queryHash lookup behavior introduced by TanStack#10750 and covers the persistence failure reported in TanStack#6958.

Constraint: The runtime lookup fix already shipped in TanStack#10750

Rejected: Reapply queryCache.get changes | current main already contains the implementation

Confidence: high

Scope-risk: narrow

Tested: query-devtools 246 tests; ESLint; TypeScript current; Prettier

Related: TanStack#6958
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8bae5cc7-4516-4aa4-9a4a-6016502c98ee

📥 Commits

Reviewing files that changed from the base of the PR and between b2ce5bc and 11751a0.

📒 Files selected for processing (1)
  • packages/query-devtools/src/__tests__/Devtools.test.tsx

📝 Walkthrough

Walkthrough

The devtools test suite now validates that a query using a custom queryKeyHashFn remains visible after dehydration and hydration into a newly recreated QueryClient.

Changes

Devtools hydration coverage

Layer / File(s) Summary
Hydrated query list test
packages/query-devtools/src/__tests__/Devtools.test.tsx
Adds dehydrate and hydrate imports and tests rendering a rehydrated custom-hash query in the devtools panel.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: tkdodo

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is clear, but it does not follow the required template sections for Changes, Checklist, and Release Impact. Rewrite it using the repository template and include the changes, checklist items, and release impact details.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the test change and the custom-hash query regression being covered.
Linked Issues check ✅ Passed The new regression test covers the hydrated custom queryKeyHashFn path and verifies the queryHash lookup tied to #6958.
Out of Scope Changes check ✅ Passed The change stays focused on Devtools test coverage and does not introduce unrelated code or public API changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@ckdwns9121 ckdwns9121 marked this pull request as ready for review July 13, 2026 05:49
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.

Devtools + async persistence + custom queryKeyHashFn doesn't work

1 participant