Skip to content

refactor: auto-resize panel to fit query plan list - #237

Merged
rapids-bot[bot] merged 22 commits into
rapidsai:mainfrom
cmatzenbach:auto-fit-query-plans
Jul 30, 2026
Merged

refactor: auto-resize panel to fit query plan list#237
rapids-bot[bot] merged 22 commits into
rapidsai:mainfrom
cmatzenbach:auto-fit-query-plans

Conversation

@cmatzenbach

@cmatzenbach cmatzenbach commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Description

Detects the size of the query plan list and auto-resizes the ResizablePanel container to fit the plans. Set's a max-height of 300px so plans will start scrolling and not cause the DAG to be too small.

Related Issues

Relates to #146

Screenshots

Screenshot_20260616_162345

5 plans:

Screenshot_20260616_162843

After hitting max height:

Screenshot_20260616_162938

Comment thread ui/src/components/QueryPlan.tsx Outdated
@johallar

Copy link
Copy Markdown
Contributor

Seeing an error when navigating to the "settings" tab:

installHook.js:1 ReferenceError: renderOption is not defined
    at select-field.tsx:89:20
    at Array.map (<anonymous>)
    at SelectField (select-field.tsx:87:23)


The above error occurred in the <SelectField> component.

React will try to recreate this component tree from scratch using the error boundary you provided, CatchBoundaryImpl.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Query plan panel resizing

Layer / File(s) Summary
Measure tree content and resize panel
ui/src/components/QueryPlan.tsx
QueryPlan measures tree and tab-header heights after tree or plan changes, clamps the result to 300px, and imperatively resizes the top panel.

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

Suggested reviewers: johallar

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: auto-resizing the query plan panel.
Description check ✅ Passed The description covers the change, related issue, and screenshots, but it omits the template's Testing section.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments (1)
ui/src/components/QueryPlan.tsx-94-107 (1)

94-107: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Resize the panel when the tree height changes. This effect only runs on treeData/planId, so expanding or collapsing nodes, or any reflow that changes scrollHeight, can leave the panel at the wrong size. Use a ResizeObserver or expansion callback on the content element and clean it up.

🤖 Prompt for 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.

In `@ui/src/components/QueryPlan.tsx` around lines 94 - 107, Update the resizing
logic in QueryPlan’s useLayoutEffect to observe treeContent height changes, not
only treeData or planId updates. Use a ResizeObserver or equivalent expansion
callback to recalculate and apply the capped height through topPanel.resize, and
clean up the observer when the effect unmounts or dependencies change.

Source: Path instructions

🤖 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 `@ui/packages/`@quent/components/src/ui/select-field.tsx:
- Line 89: Add renderOption to the SelectField props destructuring alongside the
other component props so the option mapping expression can use it safely. Add a
regression test covering both the custom renderOption path and the opt.label ??
opt.value fallback path.

In `@ui/src/components/QueryPlan.tsx`:
- Line 183: Update the top ResizablePanel in QueryPlan to pass
maxSize={MAX_TOP_PANEL_HEIGHT_PX}, ensuring user resizing cannot exceed the
300px cap while preserving the existing defaultSize and panelRef behavior.

---

Other comments:
In `@ui/src/components/QueryPlan.tsx`:
- Around line 94-107: Update the resizing logic in QueryPlan’s useLayoutEffect
to observe treeContent height changes, not only treeData or planId updates. Use
a ResizeObserver or equivalent expansion callback to recalculate and apply the
capped height through topPanel.resize, and clean up the observer when the effect
unmounts or dependencies change.
🪄 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: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Enterprise

Run ID: ab6cdb7e-7c64-4dd4-8d9c-648e23356272

📥 Commits

Reviewing files that changed from the base of the PR and between 4a3107e and 407bac2.

📒 Files selected for processing (2)
  • ui/packages/@quent/components/src/ui/select-field.tsx
  • ui/src/components/QueryPlan.tsx

options.map(opt => (
<SelectItem key={opt.value} value={opt.value} className="text-xs">
{opt.label ?? opt.value}
{renderOption ? renderOption(opt) : (opt.label ?? opt.value)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Destructure renderOption before using it.

renderOption is referenced here but is not included in the SelectField props destructuring at Lines 41-52. This causes ReferenceError: renderOption is not defined whenever options are mapped, so the fallback is never reached. Add renderOption to the destructured props and cover both renderer and fallback paths with a regression test.

Proposed fix
 export const SelectField = ({
   icon: Icon,
   label,
   options,
+  renderOption,
   value,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{renderOption ? renderOption(opt) : (opt.label ?? opt.value)}
export const SelectField = ({
icon: Icon,
label,
options,
renderOption,
value,
🤖 Prompt for 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.

In `@ui/packages/`@quent/components/src/ui/select-field.tsx at line 89, Add
renderOption to the SelectField props destructuring alongside the other
component props so the option mapping expression can use it safely. Add a
regression test covering both the custom renderOption path and the opt.label ??
opt.value fallback path.

Comment thread ui/src/components/QueryPlan.tsx Outdated
@cmatzenbach

Copy link
Copy Markdown
Contributor Author

Seeing an error when navigating to the "settings" tab:

installHook.js:1 ReferenceError: renderOption is not defined
    at select-field.tsx:89:20
    at Array.map (<anonymous>)
    at SelectField (select-field.tsx:87:23)


The above error occurred in the <SelectField> component.

React will try to recreate this component tree from scratch using the error boundary you provided, CatchBoundaryImpl.

Good catch, bad cleanup from one of the recent rebases

@cmatzenbach
cmatzenbach requested a review from johallar July 21, 2026 17:17

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
ui/src/components/QueryPlan.tsx (1)

183-183: 🎯 Functional Correctness | 🟠 Major

Still enforce the 300px cap on the ResizablePanel.

Math.min(...) limits only the effect-driven resize. Because the top panel still has no maxSize, users can drag it beyond MAX_TOP_PANEL_HEIGHT_PX, defeating the PR’s maximum-height objective. Add maxSize={MAX_TOP_PANEL_HEIGHT_PX} to the top ResizablePanel.

🤖 Prompt for 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.

In `@ui/src/components/QueryPlan.tsx` at line 183, Add
maxSize={MAX_TOP_PANEL_HEIGHT_PX} to the top ResizablePanel in QueryPlan,
alongside its existing panelRef and defaultSize props, so both dragging and
effect-driven resizing enforce the 300px maximum.
🤖 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.

Duplicate comments:
In `@ui/src/components/QueryPlan.tsx`:
- Line 183: Add maxSize={MAX_TOP_PANEL_HEIGHT_PX} to the top ResizablePanel in
QueryPlan, alongside its existing panelRef and defaultSize props, so both
dragging and effect-driven resizing enforce the 300px maximum.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Enterprise

Run ID: a42c8335-5147-406c-b7eb-78531c7ee35c

📥 Commits

Reviewing files that changed from the base of the PR and between 407bac2 and 07ec447.

📒 Files selected for processing (1)
  • ui/src/components/QueryPlan.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ui/src/components/QueryPlan.tsx (1)

98-107: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Recompute the plan panel height when the Query Plan content changes. treeData/planId only cover data updates; TreeView expand/collapse and switching back from Settings can leave the top panel at a stale height. Track the active tab and observe treeContent with a ResizeObserver that disconnects in cleanup.

🤖 Prompt for 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.

In `@ui/src/components/QueryPlan.tsx` around lines 98 - 107, The height effect in
QueryPlan must also respond to active-tab changes and TreeView content resizing.
Update the useLayoutEffect around treeContentRef/topPanelRef to include the
active tab dependency and attach a ResizeObserver to treeContent that reruns the
existing capped resize calculation, disconnecting the observer during cleanup.
🤖 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.

Outside diff comments:
In `@ui/src/components/QueryPlan.tsx`:
- Around line 98-107: The height effect in QueryPlan must also respond to
active-tab changes and TreeView content resizing. Update the useLayoutEffect
around treeContentRef/topPanelRef to include the active tab dependency and
attach a ResizeObserver to treeContent that reruns the existing capped resize
calculation, disconnecting the observer during cleanup.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Enterprise

Run ID: 99c472e4-f6e2-4be2-8c7f-5eb66969cd29

📥 Commits

Reviewing files that changed from the base of the PR and between 07ec447 and e6a0484.

📒 Files selected for processing (1)
  • ui/src/components/QueryPlan.tsx

@cmatzenbach

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot
rapids-bot Bot merged commit 5163915 into rapidsai:main Jul 30, 2026
15 checks passed
@cmatzenbach
cmatzenbach deleted the auto-fit-query-plans branch July 30, 2026 19:40
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.

2 participants