Repository navigation
collapsible request/response split in request tab - #7566
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds per-tab request/response pane collapse state, UI indicators with keyboard/pointer drag handling, collapse-on-edge detection during resize, hook APIs to control collapse/expand, Redux actions/reducers to persist collapse and saved sizes, and styling/layout adjustments for collapsed panes. Changes
Sequence DiagramsequenceDiagram
participant User as User
participant Indicator as CollapsedPanelIndicator
participant Panel as RequestTabPanel
participant Hook as useTabPaneBoundaries
participant Store as Redux Store
User->>Indicator: click / keypress / pointer-down
Indicator->>Panel: onExpand() / onDragStart(event)
Panel->>Hook: collapseRequest()/collapseResponse()/expandRequest()/expandResponse()
Hook->>Store: dispatch collapse/expand action
Store->>Store: update collapsed flags & saved sizes
Store-->>Hook: updated state
Hook-->>Panel: new collapsed state
Panel-->>User: UI re-render (collapsed/expanded)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/bruno-app/src/hooks/useTabPaneBoundaries/index.js (1)
57-67:⚠️ Potential issue | 🟡 MinorReset currently restores the stale pre-collapse request size.
If the request pane is collapsed,
expandRequestPane()rewrites the just-reset width/height withrequestPaneWidthBeforeCollapseandrequestPaneHeightBeforeCollapse, soreset()does not actually reset the split.Possible fix
reset() { + dispatch(expandRequestPane({ uid: activeTabUid })); + dispatch(expandResponsePane({ uid: activeTabUid })); dispatch(updateRequestPaneTabHeight({ uid: activeTabUid, requestPaneHeight: MIN_TOP_PANE_HEIGHT })); dispatch(updateRequestPaneTabWidth({ uid: activeTabUid, requestPaneWidth: (screenWidth - asideWidth) / DEFAULT_PANE_WIDTH_DIVISOR })); - dispatch(expandRequestPane({ uid: activeTabUid })); - dispatch(expandResponsePane({ uid: activeTabUid })); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/hooks/useTabPaneBoundaries/index.js` around lines 57 - 67, reset() sets the request pane size but then expandRequestPane() restores stale requestPaneWidthBeforeCollapse/requestPaneHeightBeforeCollapse values, so modify reset() to clear those "before collapse" fields for the activeTabUid before calling expandRequestPane; specifically, dispatch an action (or reuse updateRequestPaneTabWidth/updateRequestPaneTabHeight to set requestPaneWidthBeforeCollapse and requestPaneHeightBeforeCollapse to null/undefined for activeTabUid) and only then call expandRequestPane({ uid: activeTabUid }) and expandResponsePane; this ensures the width/height you set in reset() are not overwritten by expandRequestPane().
🧹 Nitpick comments (1)
packages/bruno-app/src/components/RequestTabPanel/CollapsedPanelIndicator/index.js (1)
5-11: Document this component's interaction contract.A short JSDoc block would help here because the click-vs-drag handoff and the
panelType/dragThresholdPxexpectations are not obvious from the call site.As per coding guidelines, "Add JSDoc comments to abstractions for additional details."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/components/RequestTabPanel/CollapsedPanelIndicator/index.js` around lines 5 - 11, Add a JSDoc block above the CollapsedPanelIndicator component that documents its interaction contract: describe accepted prop values for panelType ('request' | 'response'), isVertical (boolean), and dragThresholdPx (number, pixels threshold used to differentiate click vs drag), explain the click-vs-drag handoff behavior (short press/click invokes onExpand, pointer movement beyond dragThresholdPx invokes onDragStart), and specify the expected signatures and event types for onExpand and onDragStart (e.g., (event: MouseEvent|PointerEvent) => void) so callers know how to use and test the component.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@packages/bruno-app/src/components/RequestTabPanel/CollapsedPanelIndicator/StyledWrapper.js`:
- Around line 15-17: The current StyledWrapper removes the focus outline (the
&:focus rule) making the collapsed strip invisible to keyboard users; update the
StyledWrapper component to replace outline: none with an accessible visible
focus style (use &:focus and/or &:focus-visible) that applies a clear focus ring
such as a themed box-shadow or border highlight so the expand affordance is
visible when focused (reference the StyledWrapper styled component and its
&:focus selector).
In `@packages/bruno-app/src/components/RequestTabPanel/index.js`:
- Around line 195-203: The drag-start handlers (handleRequestIndicatorDragStart
and handleResponseIndicatorDragStart) expand the pane and arm dragging but never
apply the current pointer position, so if the user crosses the threshold and
releases before the next mousemove the splitter snaps to the old position; fix
by reading the pointer coords from the event (e.clientX / e.clientY) and
immediately calling the same splitter-position updater used during dragging (the
function or setter that updates the split position / moveSplitter) before or as
part of startDragging, so the splitter is placed at the current pointer location
right away; update both handleRequestIndicatorDragStart and
handleResponseIndicatorDragStart to apply the pointer-derived position via that
updater (or extend startDragging to accept and apply the initial coordinates)
and keep expandRequest/expandResponse calls as-is.
---
Outside diff comments:
In `@packages/bruno-app/src/hooks/useTabPaneBoundaries/index.js`:
- Around line 57-67: reset() sets the request pane size but then
expandRequestPane() restores stale
requestPaneWidthBeforeCollapse/requestPaneHeightBeforeCollapse values, so modify
reset() to clear those "before collapse" fields for the activeTabUid before
calling expandRequestPane; specifically, dispatch an action (or reuse
updateRequestPaneTabWidth/updateRequestPaneTabHeight to set
requestPaneWidthBeforeCollapse and requestPaneHeightBeforeCollapse to
null/undefined for activeTabUid) and only then call expandRequestPane({ uid:
activeTabUid }) and expandResponsePane; this ensures the width/height you set in
reset() are not overwritten by expandRequestPane().
---
Nitpick comments:
In
`@packages/bruno-app/src/components/RequestTabPanel/CollapsedPanelIndicator/index.js`:
- Around line 5-11: Add a JSDoc block above the CollapsedPanelIndicator
component that documents its interaction contract: describe accepted prop values
for panelType ('request' | 'response'), isVertical (boolean), and
dragThresholdPx (number, pixels threshold used to differentiate click vs drag),
explain the click-vs-drag handoff behavior (short press/click invokes onExpand,
pointer movement beyond dragThresholdPx invokes onDragStart), and specify the
expected signatures and event types for onExpand and onDragStart (e.g., (event:
MouseEvent|PointerEvent) => void) so callers know how to use and test the
component.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0f79ea15-a1d0-447f-a21a-19ed6762ecd7
📒 Files selected for processing (6)
packages/bruno-app/src/components/RequestTabPanel/CollapsedPanelIndicator/StyledWrapper.jspackages/bruno-app/src/components/RequestTabPanel/CollapsedPanelIndicator/index.jspackages/bruno-app/src/components/RequestTabPanel/StyledWrapper.jspackages/bruno-app/src/components/RequestTabPanel/index.jspackages/bruno-app/src/hooks/useTabPaneBoundaries/index.jspackages/bruno-app/src/providers/ReduxStore/slices/tabs.js
d210e5f to
c39adc0
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
packages/bruno-app/src/components/RequestTabPanel/index.js (1)
209-217:⚠️ Potential issue | 🟠 MajorApply the current pointer position when drag-expanding a collapsed pane.
These handlers reopen the pane and start dragging, but they still wait for the next
mousemovebefore updating the split. If the threshold is crossed and the mouse is released immediately, the pane snaps back to the saved/default size instead of the dragged position.💡 Possible fix
+ const syncPaneSizeFromPointer = useCallback((e) => { + const mainRect = mainSectionRef.current?.getBoundingClientRect(); + if (!mainRect) { + return; + } + + if (isVerticalLayoutRef.current) { + const maxHeight = mainRect.height - MIN_BOTTOM_PANE_HEIGHT; + const nextHeight = Math.max(MIN_TOP_PANE_HEIGHT, Math.min(e.clientY - mainRect.top, maxHeight)); + setTopPaneHeight(nextHeight); + return; + } + + const maxWidth = mainRect.width - MIN_RIGHT_PANE_WIDTH; + const nextWidth = Math.max(MIN_LEFT_PANE_WIDTH, Math.min(e.clientX - mainRect.left, maxWidth)); + setLeftPaneWidth(nextWidth); + }, [setTopPaneHeight, setLeftPaneWidth]); + const handleRequestIndicatorDragStart = useCallback((e) => { expandRequest(); + syncPaneSizeFromPointer(e); startDragging(e); - }, [expandRequest, startDragging]); + }, [expandRequest, syncPaneSizeFromPointer, startDragging]); const handleResponseIndicatorDragStart = useCallback((e) => { expandResponse(); + syncPaneSizeFromPointer(e); startDragging(e); - }, [expandResponse, startDragging]); + }, [expandResponse, syncPaneSizeFromPointer, startDragging]);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/components/RequestTabPanel/index.js` around lines 209 - 217, The pane reopens then waits for the next mousemove so immediate drag position isn't applied; modify handleRequestIndicatorDragStart and handleResponseIndicatorDragStart to read the pointer position from the incoming event (e.g., clientX/clientY) and invoke the same update routine used on mousemove to set the split immediately (before or right after calling startDragging), so expandRequest/expandResponse + startDragging both apply the current pointer position instead of waiting for the next mousemove. Ensure you call the shared move/update handler (the function used in the mousemove handler) with the event-derived coordinates so the pane size reflects the initial press.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/bruno-app/src/components/RequestTabPanel/index.js`:
- Around line 420-442: The indentation of the JSX/returned block around
getRequestPaneStyle is inconsistent with the project's 2-space rule, causing
`@stylistic/indent` failures; reformat the JSX starting from the return
(ScopedPersistenceProvider) through the StyledWrapper opening tag so all nested
attributes and ternary className expressions use 2 spaces per indent (no tabs),
align the multiline ternary fragments and template literals consistently, and
ensure closing braces/parentheses line up with their openings (referencing
getRequestPaneStyle, ScopedPersistenceProvider, StyledWrapper, and
focusedTab.uid to locate the block).
---
Duplicate comments:
In `@packages/bruno-app/src/components/RequestTabPanel/index.js`:
- Around line 209-217: The pane reopens then waits for the next mousemove so
immediate drag position isn't applied; modify handleRequestIndicatorDragStart
and handleResponseIndicatorDragStart to read the pointer position from the
incoming event (e.g., clientX/clientY) and invoke the same update routine used
on mousemove to set the split immediately (before or right after calling
startDragging), so expandRequest/expandResponse + startDragging both apply the
current pointer position instead of waiting for the next mousemove. Ensure you
call the shared move/update handler (the function used in the mousemove handler)
with the event-derived coordinates so the pane size reflects the initial press.
🪄 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: CHILL
Plan: Pro
Run ID: d1d12767-dc53-49bc-bb2a-a929ff28b75d
📒 Files selected for processing (6)
packages/bruno-app/src/components/RequestTabPanel/CollapsedPanelIndicator/StyledWrapper.jspackages/bruno-app/src/components/RequestTabPanel/CollapsedPanelIndicator/index.jspackages/bruno-app/src/components/RequestTabPanel/StyledWrapper.jspackages/bruno-app/src/components/RequestTabPanel/index.jspackages/bruno-app/src/hooks/useTabPaneBoundaries/index.jspackages/bruno-app/src/providers/ReduxStore/slices/tabs.js
🚧 Files skipped from review as they are similar to previous changes (5)
- packages/bruno-app/src/hooks/useTabPaneBoundaries/index.js
- packages/bruno-app/src/providers/ReduxStore/slices/tabs.js
- packages/bruno-app/src/components/RequestTabPanel/CollapsedPanelIndicator/index.js
- packages/bruno-app/src/components/RequestTabPanel/StyledWrapper.js
- packages/bruno-app/src/components/RequestTabPanel/CollapsedPanelIndicator/StyledWrapper.js
There was a problem hiding this comment.
♻️ Duplicate comments (1)
packages/bruno-app/src/components/RequestTabPanel/index.js (1)
209-217:⚠️ Potential issue | 🟠 MajorPointer position not synced immediately on expand.
These handlers expand the pane and arm dragging, but never apply the current pointer position. If the user crosses the drag threshold and releases before the next
mousemove, the pane reopens at the stored/default split instead of where they dragged.Apply the pointer-derived split position immediately after expanding:
Possible fix
+ const syncPaneSizeFromPointer = useCallback((e) => { + const mainRect = mainSectionRef.current?.getBoundingClientRect(); + if (!mainRect) return; + + if (isVerticalLayoutRef.current) { + const maxHeight = mainRect.height - MIN_BOTTOM_PANE_HEIGHT; + const nextHeight = Math.max(MIN_TOP_PANE_HEIGHT, Math.min(e.clientY - mainRect.top, maxHeight)); + setTopPaneHeight(nextHeight); + return; + } + + const maxWidth = mainRect.width - MIN_RIGHT_PANE_WIDTH; + const nextWidth = Math.max(MIN_LEFT_PANE_WIDTH, Math.min(e.clientX - mainRect.left, maxWidth)); + setLeftPaneWidth(nextWidth); + }, [setTopPaneHeight, setLeftPaneWidth]); const handleRequestIndicatorDragStart = useCallback((e) => { expandRequest(); + syncPaneSizeFromPointer(e); startDragging(e); - }, [expandRequest, startDragging]); + }, [expandRequest, syncPaneSizeFromPointer, startDragging]); const handleResponseIndicatorDragStart = useCallback((e) => { expandResponse(); + syncPaneSizeFromPointer(e); startDragging(e); - }, [expandResponse, startDragging]); + }, [expandResponse, syncPaneSizeFromPointer, startDragging]);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/components/RequestTabPanel/index.js` around lines 209 - 217, The drag-start handlers expand the pane and begin dragging but don't apply the current pointer-derived split, so if the user releases before the next mousemove the split snaps back; in handleRequestIndicatorDragStart and handleResponseIndicatorDragStart, after calling expandRequest()/expandResponse() and before startDragging(e) (or immediately after), compute and apply the split position from the incoming event by invoking the same helper used on mousemove (the pointer-to-split setter used elsewhere—e.g. the function that onMouseMove uses to derive and set split) so the immediate pointer location is applied to the splitter state while dragging is armed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@packages/bruno-app/src/components/RequestTabPanel/index.js`:
- Around line 209-217: The drag-start handlers expand the pane and begin
dragging but don't apply the current pointer-derived split, so if the user
releases before the next mousemove the split snaps back; in
handleRequestIndicatorDragStart and handleResponseIndicatorDragStart, after
calling expandRequest()/expandResponse() and before startDragging(e) (or
immediately after), compute and apply the split position from the incoming event
by invoking the same helper used on mousemove (the pointer-to-split setter used
elsewhere—e.g. the function that onMouseMove uses to derive and set split) so
the immediate pointer location is applied to the splitter state while dragging
is armed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: bb3da678-9a73-41d5-a363-a8bfb65b5d6e
📒 Files selected for processing (1)
packages/bruno-app/src/components/RequestTabPanel/index.js
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/bruno-app/src/components/RequestTabPanel/index.js (1)
467-503: Add stable selectors for the new collapsed-pane controls.These indicators are new interactive entry points, but they do not expose a stable
data-testid, so Playwright coverage for collapse/expand and drag-to-expand will be brittle.As per coding guidelines,
**/*.{ts,tsx,js,jsx}: Adddata-testidto testable elements for Playwright.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-app/src/components/RequestTabPanel/index.js` around lines 467 - 503, The collapsed-panel indicators lack stable selectors; update the JSX in RequestTabPanel to add data-testid attributes to the interactive elements: pass a predictable data-testid prop into both CollapsedPanelIndicator usages (e.g., data-testid="collapsed-request-indicator" and data-testid="collapsed-response-indicator") and add a data-testid on the drag bar container div (the element with className "dragbar-wrapper", used with startDragging/resetPaneBoundaries) so Playwright can target collapse/expand and drag-to-expand reliably; ensure the identifiers reference the existing handlers (expandRequest, expandResponse, handleRequestIndicatorDragStart, handleResponseIndicatorDragStart) so semantics remain unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/bruno-app/src/components/RequestTabPanel/index.js`:
- Around line 439-455: The request pane loses the user's vertical split when
responsePaneCollapsed is true because getRequestPaneStyle returns flex styles
instead of preserving topPaneHeight; update getRequestPaneStyle (and the resize
logic that writes topPaneHeight) to preserve/restore the hidden height: add a
cachedTopPaneHeight (set when collapsing: cachedTopPaneHeight = topPaneHeight)
and on expand restore topPaneHeight from cachedTopPaneHeight, and change
getRequestPaneStyle to return the stored height for the vertical + collapsed
case (use cachedTopPaneHeight or MIN_TOP_PANE_HEIGHT capped via Math.max), and
ensure the pane resize handler skips updating topPaneHeight while
responsePaneCollapsed so DevTools resizes don't overwrite the cached value.
---
Nitpick comments:
In `@packages/bruno-app/src/components/RequestTabPanel/index.js`:
- Around line 467-503: The collapsed-panel indicators lack stable selectors;
update the JSX in RequestTabPanel to add data-testid attributes to the
interactive elements: pass a predictable data-testid prop into both
CollapsedPanelIndicator usages (e.g., data-testid="collapsed-request-indicator"
and data-testid="collapsed-response-indicator") and add a data-testid on the
drag bar container div (the element with className "dragbar-wrapper", used with
startDragging/resetPaneBoundaries) so Playwright can target collapse/expand and
drag-to-expand reliably; ensure the identifiers reference the existing handlers
(expandRequest, expandResponse, handleRequestIndicatorDragStart,
handleResponseIndicatorDragStart) so semantics remain unchanged.
🪄 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: CHILL
Plan: Pro
Run ID: bc5b4d60-8c78-4da4-b86b-9daf9dd88163
📒 Files selected for processing (1)
packages/bruno-app/src/components/RequestTabPanel/index.js
Description
JIRA
Add collapse and expand behaviour for the request and response panes in the request tab.
Screenshots
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit
New Features
Style / UI Improvements