Skip to content

test(query-devtools/Explorer): add tests for 'defaultExpanded' and pagination behavior#10727

Open
sukvvon wants to merge 1 commit into
mainfrom
test/query-devtools-explorer-props-behavior
Open

test(query-devtools/Explorer): add tests for 'defaultExpanded' and pagination behavior#10727
sukvvon wants to merge 1 commit into
mainfrom
test/query-devtools-explorer-props-behavior

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented May 18, 2026

🎯 Changes

Extend Explorer.test.tsx with tests for props-driven behavior — defaultExpanded and pagination of large arrays (subEntryPages.length > 1 branch).

Added cases:

  • "defaultExpanded" (1)
    • should render children eagerly when the label is in "defaultExpanded" — the call site Devtools.tsx always passes defaultExpanded={['Data']}, so this locks the contract that the Data panel renders pre-expanded.
  • pagination (3)
    • should group entries into 100-item pages when the array has more than 100 entries
    • should keep the items of a page hidden until the page header is clicked
    • should reveal the items of a page when the page header is clicked

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Expanded test coverage for the Explorer component's defaultExpanded behavior and array pagination functionality, including validation of expanded state rendering and pagination interactions for large arrays.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9f492f7d-5909-4551-a033-709c7dc6c80d

📥 Commits

Reviewing files that changed from the base of the PR and between 334161f and fc5baa9.

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

📝 Walkthrough

Walkthrough

This PR adds test coverage for two Explorer component features: validation that defaultExpanded prop renders children in an expanded state immediately, and verification that arrays exceeding 100 items paginate correctly into grouped pages with proper visibility toggling.

Changes

Explorer Component Test Coverage

Layer / File(s) Summary
defaultExpanded behavior tests
packages/query-devtools/src/__tests__/Explorer.test.tsx
Verifies that when a label is included in the defaultExpanded array, the expander renders in an expanded state and child entries display immediately without user interaction.
Array pagination tests
packages/query-devtools/src/__tests__/Explorer.test.tsx
Tests array pagination for 100+ items: confirms page headers render for [0...99] and [100...199] ranges, items remain hidden until a page is selected, and clicking a page header reveals entries including indices and values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • TanStack/query#10714: Extends the same Explorer.test.tsx file to validate expand/collapse rendering behavior for primitives and collections.

Suggested labels

package: query-devtools

Poem

🐰 Hopping through tests with glee and care,
Defaults expand and pages split fair,
A hundred items grouped just right,
Explorer shines with coverage bright!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main changes: adding tests for 'defaultExpanded' and pagination behavior to the Explorer component test file.
Description check ✅ Passed The description follows the template structure, includes detailed explanation of changes, marks all applicable checklist items, and correctly identifies the change as dev-only with no release impact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/query-devtools-explorer-props-behavior

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

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 18, 2026

View your CI Pipeline Execution ↗ for commit fc5baa9

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 3m 44s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 28s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-18 17:47:18 UTC

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

2 package(s) bumped directly, 23 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/vue-query 5.100.10 → 5.100.11 Changeset
@tanstack/vue-query-devtools 6.1.29 → 6.1.30 Changeset
@tanstack/angular-query-experimental 5.100.10 → 5.100.11 Dependent
@tanstack/angular-query-persist-client 5.100.10 → 5.100.11 Dependent
@tanstack/eslint-plugin-query 5.100.10 → 5.100.11 Dependent
@tanstack/lit-query 0.2.1 → 0.2.2 Dependent
@tanstack/preact-query 5.100.10 → 5.100.11 Dependent
@tanstack/preact-query-devtools 5.100.10 → 5.100.11 Dependent
@tanstack/preact-query-persist-client 5.100.10 → 5.100.11 Dependent
@tanstack/query-async-storage-persister 5.100.10 → 5.100.11 Dependent
@tanstack/query-broadcast-client-experimental 5.100.10 → 5.100.11 Dependent
@tanstack/query-core 5.100.10 → 5.100.11 Dependent
@tanstack/query-devtools 5.100.10 → 5.100.11 Dependent
@tanstack/query-persist-client-core 5.100.10 → 5.100.11 Dependent
@tanstack/query-sync-storage-persister 5.100.10 → 5.100.11 Dependent
@tanstack/react-query 5.100.10 → 5.100.11 Dependent
@tanstack/react-query-devtools 5.100.10 → 5.100.11 Dependent
@tanstack/react-query-next-experimental 5.100.10 → 5.100.11 Dependent
@tanstack/react-query-persist-client 5.100.10 → 5.100.11 Dependent
@tanstack/solid-query 5.100.10 → 5.100.11 Dependent
@tanstack/solid-query-devtools 5.100.10 → 5.100.11 Dependent
@tanstack/solid-query-persist-client 5.100.10 → 5.100.11 Dependent
@tanstack/svelte-query 6.1.29 → 6.1.30 Dependent
@tanstack/svelte-query-devtools 6.1.29 → 6.1.30 Dependent
@tanstack/svelte-query-persist-client 6.1.29 → 6.1.30 Dependent

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 18, 2026

More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@10727

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@10727

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@10727

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@10727

@tanstack/preact-query-devtools

npm i https://pkg.pr.new/@tanstack/preact-query-devtools@10727

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@10727

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@10727

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@10727

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@10727

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@10727

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@10727

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@10727

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@10727

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@10727

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@10727

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@10727

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@10727

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@10727

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@10727

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@10727

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@10727

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@10727

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@10727

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@10727

commit: fc5baa9

@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 12.1 KB (0%)
react minimal 9.07 KB (0%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant