Skip to content

refactor: update ResponsePane and QueryResultTypeSelector - #6490

Merged
bijin-bruno merged 2 commits into
usebruno:mainfrom
abhishek-bruno:feat/response-pane-update
Dec 23, 2025
Merged

bijin-bruno merged 2 commits into
usebruno:mainfrom
abhishek-bruno:feat/response-pane-update

Conversation

@abhishek-bruno

@abhishek-bruno abhishek-bruno commented Dec 23, 2025 •

Copy link
Copy Markdown
Member

Description

JIRA
Update ResponsePane and QueryResultTypeSelector for improved tab handling and styling

  • Adjusted the expanded width for right-side action buttons in ResponsePane.
  • Refactored view tab toggle logic to enhance clarity and functionality.
  • Introduced new styling for result view tabs and dropdown buttons.
  • Added icon support for format options in QueryResultTypeSelector, improving visual feedback.
  • Implemented dropdown state management to ensure proper interaction with active tabs.

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

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

  • Improvements

    • Enhanced response format selector with clearer active/inactive visuals, refreshed icons, and improved preview/editor toggle behavior.
    • Refined pane resizing and responsive tab expand/collapse logic to reduce flicker and smoother width transitions.
    • Improved spacing and styling for response tabs container and related controls.
  • Bug Fixes

    • Response tab content now only renders when response data is available, preventing empty render states.

✏️ Tip: You can customize this high-level summary in your review settings.

…d tab handling and styling

- Adjusted the expanded width for right-side action buttons in ResponsePane.
- Refactored view tab toggle logic to enhance clarity and functionality.
- Introduced new styling for result view tabs and dropdown buttons.
- Added icon support for format options in QueryResultTypeSelector, improving visual feedback.
- Implemented dropdown state management to ensure proper interaction with active tabs.
@coderabbitai

coderabbitai Bot commented Dec 23, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

This PR adjusts layout constants, refactors response-view tab wiring to an explicit change handler, adds active-state control and icon handling to the QueryResultTypeSelector, updates ResponsePane styling, and enhances ResponsiveTabs expand/collapse logic with an expandable element index and hysteresis-based decisioning.

Changes

Cohort / File(s) Summary
Layout Constants
packages/bruno-app/src/components/RequestTabPanel/index.js
MIN_RIGHT_PANE_WIDTH changed from 480 → 490, affecting drag-bar clamping and initial right-pane sizing.
Response Pane — View Tab Handling
packages/bruno-app/src/components/ResponsePane/index.js
Replaced toggle handler with handleViewTabChange(newViewTab); RIGHT_CONTENT_EXPANDED_WIDTH changed 375 → 135; now passes isActiveTab and onTabSelect to QueryResultTypeSelector; rendering of response tab now requires item?.response.
QueryResultTypeSelector Logic & Exported Props
packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/index.jsx
Added FORMAT_ICONS mapping, isActive prop for ButtonIcon, isActiveTab and onTabSelect props on component, internal dropdownOpen state and guarded dropdown opening to only-active tabs, preview/editor toggle adjustments, and left-section icon rendering.
QueryResultTypeSelector Styling
packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/StyledWrapper.js
Caret now uses theme token theme.app.collection.toolbar.environmentSelector.caret; .icon-muted class added; removed hover background effect on .button-dropdown-button.
ResponsePane Styling Wrapper
packages/bruno-app/src/components/ResponsePane/StyledWrapper.js
Added .result-view-tabs container and .tab-active modifier styles (flex layout, spacing, padding, border-radius, hover/border styles).
Responsive Tabs Expandability
packages/bruno-app/src/ui/ResponsiveTabs/index.js
Introduced EXPANDABLE_HYSTERESIS, new expandableElementIndex prop (default -1), reworked expand/collapse logic to compute totalExpandedWidth across right-side children, and applied hysteresis-aware expand/collapse conditions; effect deps include expandableElementIndex.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant QRT as QueryResultTypeSelector
    participant RP as ResponsePane
    participant RT as ResponsiveTabs

    rect rgb(235, 245, 255)
    Note over User,QRT: Tab click & activation flow
    User->>QRT: Click format / preview control
    QRT->>QRT: Check isActiveTab
    alt Not active
        QRT->>RP: onTabSelect()  -- requests activation
        RP->>RP: handleViewTabChange(newViewTab)
        RP->>RP: dispatch(updateResponseViewTab)
        RP->>QRT: re-render with isActiveTab=true
    else Active
        QRT->>QRT: Toggle dropdownOpen / render icons
    end
    end

    rect rgb(250, 245, 230)
    Note over User,RT: Resize & expand/collapse with hysteresis
    User->>RT: Resize container
    RT->>RT: Measure availableSpace
    RT->>RT: Compute totalExpandedWidth (sum right children, replace expandable index with expanded width)
    alt Currently expanded
        RT->>RT: Collapse if availableSpace < (totalExpandedWidth - EXPANDABLE_HYSTERESIS)
    else Currently collapsed
        RT->>RT: Expand if availableSpace >= totalExpandedWidth
    end
    RT->>RP: Update layout state / trigger re-render
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

size/XL

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • naman-bruno
  • bijin-bruno

Poem

Tabs wake up in brighter hue,
Icons align and peek in view,
Hysteresis hums a gentle tune,
Panels stretch beneath the moon,
Small changes, smoother UI crew. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes in the PR, which focus on refactoring the ResponsePane component and QueryResultTypeSelector with layout, styling, and interaction improvements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4831434 and 6c96210.

📒 Files selected for processing (6)
  • packages/bruno-app/src/components/RequestTabPanel/index.js
  • packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/StyledWrapper.js
  • packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/index.jsx
  • packages/bruno-app/src/components/ResponsePane/StyledWrapper.js
  • packages/bruno-app/src/components/ResponsePane/index.js
  • packages/bruno-app/src/ui/ResponsiveTabs/index.js
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions. () => {} is good
No space between function name and parentheses. func() not func ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Files:

  • packages/bruno-app/src/components/RequestTabPanel/index.js
  • packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/StyledWrapper.js
  • packages/bruno-app/src/components/ResponsePane/StyledWrapper.js
  • packages/bruno-app/src/ui/ResponsiveTabs/index.js
  • packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/index.jsx
  • packages/bruno-app/src/components/ResponsePane/index.js
**/*.{jsx,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{jsx,tsx}: Use styled component's theme prop to manage CSS colors and not CSS variables when in the context of a styled component or any React component using the styled component
Styled Components are used as wrappers to define both self and children components style; Tailwind classes are used specifically for layout based styles
Styled Component CSS might also change layout but Tailwind classes shouldn't define colors

Files:

  • packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/index.jsx
🧠 Learnings (4)
📚 Learning: 2025-12-17T21:41:24.730Z
Learnt from: naman-bruno
Repo: usebruno/bruno PR: 6407
File: packages/bruno-app/src/components/Environments/ConfirmCloseEnvironment/index.js:5-41
Timestamp: 2025-12-17T21:41:24.730Z
Learning: Do not suggest PropTypes validation for React components in the Bruno codebase. The project does not use PropTypes, so reviews should avoid proposing PropTypes and rely on the existing typing/validation approach (e.g., TypeScript or alternative runtime checks) if applicable. This guideline applies broadly to all JavaScript/JSX components in the repo.

Applied to files:

  • packages/bruno-app/src/components/RequestTabPanel/index.js
  • packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/StyledWrapper.js
  • packages/bruno-app/src/components/ResponsePane/StyledWrapper.js
  • packages/bruno-app/src/ui/ResponsiveTabs/index.js
  • packages/bruno-app/src/components/ResponsePane/index.js
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Applies to **/*.{jsx,tsx} : Styled Component CSS might also change layout but Tailwind classes shouldn't define colors

Applied to files:

  • packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/StyledWrapper.js
  • packages/bruno-app/src/components/ResponsePane/StyledWrapper.js
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Applies to **/*.{jsx,tsx} : Use styled component's theme prop to manage CSS colors and not CSS variables when in the context of a styled component or any React component using the styled component

Applied to files:

  • packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/StyledWrapper.js
  • packages/bruno-app/src/components/ResponsePane/StyledWrapper.js
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Applies to **/*.{jsx,tsx} : Styled Components are used as wrappers to define both self and children components style; Tailwind classes are used specifically for layout based styles

Applied to files:

  • packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/StyledWrapper.js
  • packages/bruno-app/src/components/ResponsePane/StyledWrapper.js
🧬 Code graph analysis (2)
packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/index.jsx (2)
packages/bruno-app/src/components/Icons/IconCaretDown/index.js (1)
  • IconCaretDown (3-16)
packages/bruno-app/src/ui/MenuDropdown/index.js (2)
  • enhancedItems (171-194)
  • MenuDropdown (53-467)
packages/bruno-app/src/components/ResponsePane/index.js (1)
packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/index.jsx (1)
  • QueryResultTypeSelector (43-142)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: Unit Tests
  • GitHub Check: CLI Tests
  • GitHub Check: SSL Tests - Linux
🔇 Additional comments (13)
packages/bruno-app/src/components/RequestTabPanel/index.js (1)

41-41: LGTM!

Minor layout adjustment to increase the minimum right pane width by 10px. This aligns with the broader right-side content expansion changes in this PR.

packages/bruno-app/src/ui/ResponsiveTabs/index.js (2)

11-11: LGTM!

Good use of hysteresis to prevent UI flickering at boundary conditions during resize operations.


87-127: Solid implementation of expandability logic with hysteresis.

The approach correctly:

  • Sums children widths while substituting the expandable element's expanded width
  • Applies hysteresis to prevent rapid state toggling at boundaries
  • Uses functional state update to access previous state for comparison

One minor observation: the rightContentRef?.current check on line 87 is good defensive coding.

packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/StyledWrapper.js (2)

5-6: LGTM!

Correctly uses theme props for caret styling, following the coding guidelines for styled components.


25-27: LGTM!

New .icon-muted class properly references theme values for text color. Consistent with the project's theming approach.

packages/bruno-app/src/components/ResponsePane/StyledWrapper.js (1)

84-109: LGTM!

New .result-view-tabs styling block correctly uses theme props for border colors. The nested selectors for button states and active tab visuals are well-structured.

Minor note: The !important declarations (lines 92, 98, 103, 106) suggest specificity conflicts. This appears intentional to override base button styles, which is acceptable here.

packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/index.jsx (4)

8-17: LGTM!

Clean icon mapping for format options. This improves visual feedback as mentioned in the PR objectives.


52-62: Good UX pattern for dropdown state management.

The handleDropdownChange logic correctly prevents the dropdown from opening when clicking on an inactive tab, instead triggering tab selection first. This aligns with the PR objective to "ensure proper interaction with active tabs."


74-86: LGTM!

Clear logic for determining the prefix icon based on the current view mode.


120-138: MenuDropdown correctly supports controlled dropdown behavior.

The component properly implements the controlled pattern with both opened and onChange props. State management correctly distinguishes between controlled mode (when opened is provided) and uncontrolled mode, with the updateOpenState function routing updates to the onChange callback when controlled or internal state when uncontrolled.

packages/bruno-app/src/components/ResponsePane/index.js (3)

29-29: Significant reduction in expanded width threshold.

The threshold dropped from 375 to 135 pixels. This means the right content will show in expanded form at much narrower widths. Verify this is the intended behavior across different viewport sizes.


73-75: LGTM!

Renamed to handleViewTabChange with a cleaner signature that explicitly sets the target tab. Dependency array correctly includes only dispatch and item.uid.


230-247: Simplify isActiveTab logic or document why it's needed.

Line 242: isActiveTab={selectedViewTab === 'editor' || selectedViewTab === 'preview'} is always true. The fallback chain on line 53 (persistedViewTab ?? initialTab ?? 'editor') ensures selectedViewTab can only be 'editor' or 'preview'. Either pass isActiveTab={true} directly or remove this prop if the component doesn't require it.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/bruno-app/src/components/ResponsePane/index.js (1)

228-247: Consider simplifying the isActiveTab prop expression.

The isActiveTab logic evaluates selectedViewTab === 'editor' || selectedViewTab === 'preview'. Given that:

  • selectedViewTab defaults to 'editor' (line 53)
  • The only values toggled are 'editor' and 'preview' (via the QueryResultTypeSelector toggle)

This expression will always be true in this context. Unless you're planning to add additional view tab states, consider simplifying to isActiveTab={true} or verify if this explicit check serves a specific purpose.

🔎 Potential simplification
           <QueryResultTypeSelector
             formatOptions={previewFormatOptions}
             formatValue={selectedFormat}
             onFormatChange={handleFormatChange}
             onPreviewTabSelect={handleViewTabChange}
             selectedTab={selectedViewTab}
-            isActiveTab={selectedViewTab === 'editor' || selectedViewTab === 'preview'}
+            isActiveTab={true}
             onTabSelect={() => {
               handleViewTabChange('editor');
             }}
           />
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6c96210 and b7cda58.

📒 Files selected for processing (1)
  • packages/bruno-app/src/components/ResponsePane/index.js
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions. () => {} is good
No space between function name and parentheses. func() not func ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Files:

  • packages/bruno-app/src/components/ResponsePane/index.js
🧠 Learnings (1)
📚 Learning: 2025-12-17T21:41:24.730Z
Learnt from: naman-bruno
Repo: usebruno/bruno PR: 6407
File: packages/bruno-app/src/components/Environments/ConfirmCloseEnvironment/index.js:5-41
Timestamp: 2025-12-17T21:41:24.730Z
Learning: Do not suggest PropTypes validation for React components in the Bruno codebase. The project does not use PropTypes, so reviews should avoid proposing PropTypes and rely on the existing typing/validation approach (e.g., TypeScript or alternative runtime checks) if applicable. This guideline applies broadly to all JavaScript/JSX components in the repo.

Applied to files:

  • packages/bruno-app/src/components/ResponsePane/index.js
🧬 Code graph analysis (1)
packages/bruno-app/src/components/ResponsePane/index.js (1)
packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/index.jsx (1)
  • QueryResultTypeSelector (43-142)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: SSL Tests - Linux
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: Unit Tests
  • GitHub Check: CLI Tests
  • GitHub Check: Playwright E2E Tests
🔇 Additional comments (2)
packages/bruno-app/src/components/ResponsePane/index.js (2)

29-29: Verify the expanded width reduction works as intended across viewport sizes.

The expanded width has been reduced from 375px to 135px (~64% reduction). While this aligns with the PR objectives, please verify that the right-side action buttons render correctly at this width across different screen sizes and don't cause layout issues or content overflow.


71-73: LGTM! Clean refactoring of the view tab handler.

The rename from handleViewTabToggle to handleViewTabChange better reflects the function's purpose, and the explicit newViewTab parameter makes the API clearer.

@bijin-bruno
bijin-bruno merged commit f1961a8 into usebruno:main Dec 23, 2025
maxenceleblanc pushed a commit to maxenceleblanc/curly_cats2 that referenced this pull request Jul 20, 2026
)

* refactor: update ResponsePane and QueryResultTypeSelector for improved tab handling and styling

- Adjusted the expanded width for right-side action buttons in ResponsePane.
- Refactored view tab toggle logic to enhance clarity and functionality.
- Introduced new styling for result view tabs and dropdown buttons.
- Added icon support for format options in QueryResultTypeSelector, improving visual feedback.
- Implemented dropdown state management to ensure proper interaction with active tabs.

* refactor: remove console log from ResponsePane for cleaner code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants