fix(query-devtools): look up selected queries by hash#10778
fix(query-devtools): look up selected queries by hash#10778raashish1601 wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughQueryDetails selection was refactored to use a shared getSelectedQuery(queryCache) that resolves the selected query by selectedQueryHash(); seven reactive subscriptions were updated to use it. A test was added verifying Query Details opens for queries built with a custom queryKeyHashFn. ChangesDevTools query selection refactor
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/query-devtools/src/Devtools.tsx`:
- Around line 1865-1873: The two subscriptions use the same function reference
(getSelectedQuery) so createSubscribeToQueryCacheBatcher stores them under the
same key and the second call overwrites the first; fix by passing distinct
callback references (e.g., wrap getSelectedQuery in a small arrow or named
wrapper) when creating activeQuery and activeQueryFresh so
queryCacheMap.set(callback, ...) receives unique keys; update the calls to
createSubscribeToQueryCacheBatcher for activeQuery and activeQueryFresh to use
those wrapped functions instead of the raw getSelectedQuery.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 856f77f6-c94d-4674-9a4f-b11a81d64357
📒 Files selected for processing (2)
packages/query-devtools/src/Devtools.tsxpackages/query-devtools/src/__tests__/Devtools.test.tsx
Summary
queryCache.get(queryHash)queryKeyHashFnWhy
Devtools already stores the selected query by hash. Looking it up directly avoids repeatedly scanning the cache and aligns the details pane with the lower-level hash lookup suggested in #6958.
Fixes #6958.
Tests
pnpm exec eslint packages/query-devtools/src/Devtools.tsx packages/query-devtools/src/__tests__/Devtools.test.tsxpnpm exec prettier --check packages/query-devtools/src/Devtools.tsx packages/query-devtools/src/__tests__/Devtools.test.tsxgit diff --checkpnpm --filter @tanstack/query-devtools buildPackage-local checks that are currently blocked in this Windows checkout:
pnpm --filter @tanstack/query-devtools test:lib -- src/__tests__/Devtools.test.tsx --coverage.enabled=falsefails before running the devtools suite withfile:///@solid-refreshpnpm --filter @tanstack/query-devtools test:types:tscurrentfails because symlink forwarding files such asroot.eslint.config.jsare checked out as plain text (../../eslint.config.js) and TypeScript tries to parse themSummary by CodeRabbit
Refactoring
Tests