Repository navigation
Feat/response tabs rewamp - #6388
Conversation
…s RequestPane and HttpRequestPane
WalkthroughReplaces the legacy RequestPaneTabs with a new ResponsiveTabs component used across request and response panes, refactors RequestTabPanel rendering and drag/resize logic (including increasing MIN_RIGHT_PANE_WIDTH), updates response-layout toggle and ResponsePane actions/UI, and applies CSS adjustments to constrain tab/side-content overflow. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45–60 minutes Points to focus on:
Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)**/*.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (CODING_STANDARDS.md)
Files:
tests/**/**.*⚙️ CodeRabbit configuration file
Files:
⏰ 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)
🔇 Additional comments (1)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
packages/bruno-app/src/components/RequestTabPanel/index.js (1)
43-46: Critical: Early return violates React's Rules of Hooks.The early return at lines 44-46 causes all subsequent hooks (
useRef,useState,useCallback,useEffect,useSelector,useDispatch) to be called conditionally. React requires hooks to be called in the same order on every render.Move all hook declarations before this early return, or restructure to guard rendering rather than hook execution.
const RequestTabPanel = () => { - if (typeof window == 'undefined') { - return <div></div>; - } const dispatch = useDispatch(); const tabs = useSelector((state) => state.tabs.tabs); // ... all other hooks ... + + if (typeof window == 'undefined') { + return <div></div>; + }Alternatively, handle the SSR case at a higher level or after the
useEffectblock around line 146.packages/bruno-app/src/components/ResponsePane/ResponseLayoutToggle/index.js (1)
7-50: Remove unused icon exportsIconDockToBottomandIconDockToRight.These custom icon components are no longer used after switching to Tabler icons and should be deleted to clean up dead code.
🧹 Nitpick comments (2)
packages/bruno-app/src/components/ResponsePane/ClearTimeline/index.js (1)
18-21: Nice UI fix; considertype="button"to prevent accidental form submits
whitespace-nowraplooks good for keeping the label on one line. If this component can ever render inside a<form>, addtype="button"to avoid default submit behavior.- <button onClick={clearResponse} className="text-link hover:underline whitespace-nowrap" title="Clear Timeline"> + <button type="button" onClick={clearResponse} className="text-link hover:underline whitespace-nowrap" title="Clear Timeline"> Clear Timeline </button>packages/bruno-app/src/components/ResponsePane/ResponseLayoutToggle/index.js (1)
87-87: Simplify boolean coercion.The double negation
!!childrenis redundant. The ternary operator already evaluates truthiness.- role={!!children ? 'button' : undefined} + role={children ? 'button' : undefined}
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
packages/bruno-app/src/components/AppTitleBar/index.js(3 hunks)packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.js(2 hunks)packages/bruno-app/src/components/RequestPane/HttpRequestPane/index.js(2 hunks)packages/bruno-app/src/components/RequestPane/RequestBody/RequestBodyMode/StyledWrapper.js(1 hunks)packages/bruno-app/src/components/RequestPane/RequestPaneTabs/index.js(0 hunks)packages/bruno-app/src/components/RequestTabPanel/index.js(7 hunks)packages/bruno-app/src/components/ResponsePane/ClearTimeline/index.js(1 hunks)packages/bruno-app/src/components/ResponsePane/ResponseLayoutToggle/index.js(3 hunks)packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.js(2 hunks)packages/bruno-app/src/components/ResponsePane/StyledWrapper.js(2 hunks)packages/bruno-app/src/components/ResponsePane/index.js(4 hunks)packages/bruno-app/src/ui/ResponsiveTabs/StyledWrapper.js(1 hunks)packages/bruno-app/src/ui/ResponsiveTabs/index.js(1 hunks)
💤 Files with no reviewable changes (1)
- packages/bruno-app/src/components/RequestPane/RequestPaneTabs/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()notfunc ()
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/AppTitleBar/index.jspackages/bruno-app/src/components/ResponsePane/index.jspackages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.jspackages/bruno-app/src/components/ResponsePane/ClearTimeline/index.jspackages/bruno-app/src/ui/ResponsiveTabs/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/StyledWrapper.jspackages/bruno-app/src/ui/ResponsiveTabs/index.jspackages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.jspackages/bruno-app/src/components/RequestTabPanel/index.jspackages/bruno-app/src/components/RequestPane/RequestBody/RequestBodyMode/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/ResponseLayoutToggle/index.jspackages/bruno-app/src/components/RequestPane/HttpRequestPane/index.js
🧠 Learnings (5)
📚 Learning: 2025-12-02T09:45:31.709Z
Learnt from: sid-bruno
Repo: usebruno/bruno PR: 6266
File: packages/bruno-app/src/components/ResponsePane/ResponseCopy/index.js:38-38
Timestamp: 2025-12-02T09:45:31.709Z
Learning: In the ResponseCopy component (packages/bruno-app/src/components/ResponsePane/ResponseCopy/index.js), the copy button is intentionally disabled using `!response.data` to prevent copying stream resets which result in empty strings.
Applied to files:
packages/bruno-app/src/components/ResponsePane/ClearTimeline/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 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/ui/ResponsiveTabs/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.jspackages/bruno-app/src/components/RequestPane/RequestBody/RequestBodyMode/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 Component CSS might also change layout but Tailwind classes shouldn't define colors
Applied to files:
packages/bruno-app/src/ui/ResponsiveTabs/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/StyledWrapper.jspackages/bruno-app/src/components/RequestPane/RequestBody/RequestBodyMode/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/StyledWrapper.js
📚 Learning: 2025-12-02T20:48:05.670Z
Learnt from: NikHillAgar
Repo: usebruno/bruno PR: 6279
File: packages/bruno-app/src/components/RequestPane/PromptVariables/PromptVariablesModal/index.js:79-86
Timestamp: 2025-12-02T20:48:05.670Z
Learning: In React 19+, ref callbacks support returning cleanup functions. When a ref callback returns a function, React will call it when the element unmounts or the ref changes, similar to useEffect cleanup. This is documented at https://react.dev/learn/manipulating-the-dom-with-refs#how-to-manage-a-list-of-refs-using-a-ref-callback
Applied to files:
packages/bruno-app/src/components/RequestTabPanel/index.js
🧬 Code graph analysis (6)
packages/bruno-app/src/components/AppTitleBar/index.js (1)
packages/bruno-app/src/components/ResponsePane/ResponseLayoutToggle/index.js (1)
ResponseLayoutToggle(73-107)
packages/bruno-app/src/components/ResponsePane/index.js (1)
packages/bruno-app/src/ui/ResponsiveTabs/index.js (1)
ResponsiveTabs(11-217)
packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.js (1)
packages/bruno-app/src/ui/ResponsiveTabs/index.js (1)
ResponsiveTabs(11-217)
packages/bruno-app/src/components/ResponsePane/ClearTimeline/index.js (1)
packages/bruno-app/src/components/ResponsePane/ResponseClear/index.js (1)
clearResponse(11-19)
packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.js (1)
packages/bruno-app/src/components/ResponsePane/ResponseLayoutToggle/index.js (1)
orientation(56-56)
packages/bruno-app/src/components/RequestPane/HttpRequestPane/index.js (1)
packages/bruno-app/src/ui/ResponsiveTabs/index.js (1)
ResponsiveTabs(11-217)
🪛 Biome (2.1.2)
packages/bruno-app/src/components/ResponsePane/index.js
[error] 168-168: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
packages/bruno-app/src/components/RequestTabPanel/index.js
[error] 57-57: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
[error] 58-58: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
[error] 79-79: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
[error] 80-80: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
[error] 82-82: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
[error] 86-86: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
[error] 87-87: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
[error] 89-89: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
[error] 90-90: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
[error] 91-91: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
[error] 92-92: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
[error] 94-94: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
[error] 103-103: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
[error] 124-124: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
[error] 132-132: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
⏰ 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: CLI Tests
- GitHub Check: Unit Tests
- GitHub Check: Playwright E2E Tests
- GitHub Check: SSL Tests - Linux
- GitHub Check: SSL Tests - macOS
- GitHub Check: SSL Tests - Windows
🔇 Additional comments (32)
packages/bruno-app/src/components/RequestTabPanel/index.js (5)
56-60: Good use of ref to prevent stale closure.Using
isVerticalLayoutRefsynced viauseEffectis the correct approach for accessing current layout state inside memoized event handlers.
103-136: Well-structured drag handlers with proper ref usage.Using
draggingReffor synchronous checks in event handlers whiledraggingstate drives CSS classes is a solid pattern. The clamping approach inhandleMouseMoveis cleaner than early returns.
138-146: LGTM!Event listener setup with proper cleanup. Dependencies correctly reference the memoized handlers.
246-298: Clean refactor of rendering logic into helper functions.Extracting
renderQueryUrl,renderRequestPane, andrenderResponsePaneimproves readability and consolidates the type-based branching. The computedrequestPaneStyleclearly handles both layout orientations.
38-41: Reasonable UX improvement.Increasing
MIN_RIGHT_PANE_WIDTHfrom 350 to 480 ensures the response pane has adequate space for content display.packages/bruno-app/src/components/ResponsePane/ResponseLayoutToggle/index.js (2)
5-5: LGTM!The Tabler icons import is correct and aligns with the PR's goal of standardizing icon usage.
98-100: LGTM!The Tabler icons are correctly integrated with appropriate size and stroke width props, and the conditional rendering based on orientation is logical.
packages/bruno-app/src/components/AppTitleBar/index.js (1)
2-2: LGTM! Clean refactor.The integration of
ResponseLayoutToggleproperly centralizes the layout toggle logic, removing the need for local state and icon management. The component is correctly imported and rendered alongside other action buttons.Also applies to: 21-21, 220-220
packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.js (1)
4-4: LGTM! Consistent icon and label updates.The changes properly integrate the new Tabler icons with correct conditional rendering based on orientation, and the label update to "Toggle layout" maintains consistency across the codebase.
Also applies to: 9-9, 169-171
packages/bruno-app/src/components/ResponsePane/index.js (2)
27-27:ResponsiveTabsmigration looks coherent; confirmtabsobject shape matches component expectations.The
tabs={allTabs},activeTab={focusedTab.responsePaneTab}, andonTabSelect={selectTab}wiring looks consistent with the new API; just ensureResponsiveTabsexpectsindicatoras a React node and that it renderslabelnodes (sincetestsuses a component label).Also applies to: 241-251
200-239: Remove this suggestion—ResponsiveTabsonly observes the ref, does not attach it.The
rightContentRefpattern is correct as written.ResponsiveTabsreceives the ref as a prop to measure the right content's width for responsive tab calculations (see line 39 and the ResizeObserver at line 100), but it never attaches or reassigns the ref itself. The div inrightContentis the sole owner, andResponsiveTabsis purely an observer. This is the intended design and does not cause ref conflicts.packages/bruno-app/src/ui/ResponsiveTabs/StyledWrapper.js (3)
4-12: LGTM! Standard flex overflow handling.The
overflow: hiddenandmin-width: 0pattern correctly prevents flex items from expanding beyond their container, which is essential for the responsive tab overflow behavior.
14-17: LGTM! More generic selector.Removing the
divelement restriction makes the styling more flexible and reusable.
19-59: LGTM! Consistent selector update.Removing the
divrestriction from.tabimproves flexibility and maintains consistency with the.more-tabschange.packages/bruno-app/src/components/ResponsePane/StyledWrapper.js (3)
4-10: LGTM! Consistent overflow handling.These constraints align with the ResponsiveTabs StyledWrapper and properly support the responsive tab overflow behavior.
24-50: LGTM! Proper ellipsis handling for tab labels.The combination of
flex-shrink: 1,overflow: hidden,text-overflow: ellipsis, andwhite-space: nowrapcorrectly handles long tab labels with truncation.
53-69: LGTM! Flex utility classes support responsive layout.These utility classes properly configure flex behavior for the right-side content areas, with appropriate grow/shrink/min-width settings for each region.
packages/bruno-app/src/components/RequestPane/RequestBody/RequestBodyMode/StyledWrapper.js (1)
3-6: Verify layout behavior with the min-width removal.Replacing
min-width: 125pxwithwhite-space: nowrapchanges the layout constraint from a fixed minimum width to text wrapping prevention. While this aligns with the responsive tab system, please verify that the RequestBodyMode component maintains proper visual appearance, especially with short content or in narrow containers.packages/bruno-app/src/components/RequestPane/HttpRequestPane/index.js (2)
18-18: LGTM! Import path updated for shared component.Moving ResponsiveTabs to the
ui/folder correctly reflects its role as a shared, reusable component.
140-147: LGTM! ResponsiveTabs integration is correct.The component props are properly configured, with
delayedTabs=['body']providing extended recalculation delay for the potentially heavy body content, and rightContent/rightContentRef correctly paired for the RequestBodyMode component.packages/bruno-app/src/components/RequestPane/GraphQLRequestPane/index.js (2)
22-22: LGTM! Consistent import path.Import updated consistently with HttpRequestPane to use the shared ResponsiveTabs component.
149-155: LGTM! ResponsiveTabs integration is correct.Props are properly configured with rightContent showing GraphQLSchemaActions and rightContentRef providing measurement reference. The absence of
delayedTabsis appropriate for GraphQL tabs.packages/bruno-app/src/ui/ResponsiveTabs/index.js (10)
1-18: LGTM! Clean imports and component signature.Constants are well-defined, and the component signature properly defaults
delayedTabsto an empty array.
19-24: LGTM! Proper state and ref initialization.State arrays and ref objects are correctly initialized for managing visible/overflow tabs and DOM element references.
26-32: LGTM! Properly memoized callback with safe dropdown hiding.The callback is correctly memoized with appropriate dependencies, and the optional chaining safely handles the dropdown reference.
34-73: LGTM! Solid visibility calculation logic.The tab visibility algorithm correctly:
- Calculates available space accounting for right content and dropdown width
- Maintains contiguous visible tabs from the start
- Ensures the active tab is always visible by swapping with the last visible tab when needed
- Handles edge cases with proper fallbacks (100px default for unmeasured tabs)
75-83: LGTM! Smart delayed recalculation with proper cleanup.The two-stage delay (setTimeout + requestAnimationFrame) allows the UI to settle before recalculating, and the
delayedTabscheck provides extended delay for heavy content. Cleanup is properly handled.
85-109: LGTM! Proper ResizeObserver setup with cleanup.The observer correctly watches both the tabs container and right content for size changes, properly debounces with requestAnimationFrame, and fully cleans up on unmount.
111-119: LGTM! Excellent ref cleanup preventing memory leaks.This effect properly removes refs for tabs that are no longer in the tabs array, preventing memory leaks from accumulating stale references.
121-135: LGTM! Proper measurement setup.The hidden style correctly positions elements for measurement without affecting layout, and
setTabRefis appropriately memoized.
137-169: LGTM! Clear tab rendering with proper accessibility.The
renderTabfunction correctly handles both dropdown and regular tab rendering with appropriate ARIA attributes. While it could be memoized, it's only used during render and doesn't need optimization.
171-217: LGTM! Well-structured render with proper accessibility.The render method correctly:
- Uses a hidden measurement container for accurate width calculations
- Conditionally renders the overflow dropdown only when needed
- Properly renders right content when provided
- Includes appropriate ARIA roles and attributes for accessibility
- Follows the project's coding standards
| const handleGqlClickReference = useCallback((reference) => { | ||
| if (docExplorerRef.current) { | ||
| docExplorerRef.current.showDocForReference(reference); | ||
| } | ||
| if (!showGqlDocs) { | ||
| setShowGqlDocs(true); | ||
| } | ||
| }; | ||
| }, []); |
There was a problem hiding this comment.
Stale closure: showGqlDocs missing from dependencies.
The callback reads showGqlDocs but the dependency array is empty. This means showGqlDocs will always reflect its initial value (false), causing setShowGqlDocs(true) to be called on every reference click regardless of current state.
const handleGqlClickReference = useCallback((reference) => {
if (docExplorerRef.current) {
docExplorerRef.current.showDocForReference(reference);
}
if (!showGqlDocs) {
setShowGqlDocs(true);
}
- }, []);
+ }, [showGqlDocs]);📝 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.
| const handleGqlClickReference = useCallback((reference) => { | |
| if (docExplorerRef.current) { | |
| docExplorerRef.current.showDocForReference(reference); | |
| } | |
| if (!showGqlDocs) { | |
| setShowGqlDocs(true); | |
| } | |
| }; | |
| }, []); | |
| const handleGqlClickReference = useCallback((reference) => { | |
| if (docExplorerRef.current) { | |
| docExplorerRef.current.showDocForReference(reference); | |
| } | |
| if (!showGqlDocs) { | |
| setShowGqlDocs(true); | |
| } | |
| }, [showGqlDocs]); |
🧰 Tools
🪛 Biome (2.1.2)
[error] 94-94: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
🤖 Prompt for AI Agents
In packages/bruno-app/src/components/RequestTabPanel/index.js around lines
94-101, the useCallback for handleGqlClickReference closes over showGqlDocs but
declares an empty dependency array, causing a stale closure; either include
showGqlDocs in the dependency array (e.g. [showGqlDocs]) so the callback sees
updates, or avoid the dependency by using a functional state update
(setShowGqlDocs(prev => prev || true)) and keep the dependency array empty;
ensure docExplorerRef usage remains unchanged.
…nd layout adjustments
…ponsePane components
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.js (1)
114-121: Remove redundant Tailwind classes.The Tailwind classes
flex items-center gap-[2px]duplicate the styling already defined in StyledWrapper for.actions-buttons. Keeping both creates maintenance overhead.Apply this diff:
- <div className="actions-buttons flex items-center gap-[2px]"> + <div className="actions-buttons">packages/bruno-app/src/ui/ResponsiveTabs/index.js (2)
40-80: Clarify the fallback logic for offsetWidth calculations.Lines 45 and 54 use
|| 0and|| 100after adding 20 to offsetWidth values. IfoffsetWidthis 0 (a valid value), the expression0 + 20 || fallbackwill evaluate to20, not the fallback. This might be intentional for minimum spacing, but the logic is unclear.Consider using explicit checks or nullish coalescing for clarity:
- const rightContentWidth = rightContentRef?.current?.offsetWidth + 20 || 0; + const rightContentWidth = (rightContentRef?.current?.offsetWidth ?? 0) + 20;- const tabWidth = tabElement?.offsetWidth + 20 || 100; + const tabWidth = (tabElement?.offsetWidth ?? 100) + 20;This makes it clear that 20 is always added as spacing, and the fallback applies to the base width.
175-220: Consider extracting hardcoded minWidth value.Line 207 hardcodes
minWidth: '150px'for the dropdown. For consistency with other constants in the file (likeDROPDOWN_WIDTH), consider extracting this to a named constant.const DROPDOWN_WIDTH = 60; +const DROPDOWN_MIN_WIDTH = 150; const CALCULATION_DELAY_DEFAULT = 20;- <div style={{ minWidth: '150px' }}> + <div style={{ minWidth: `${DROPDOWN_MIN_WIDTH}px` }}>Otherwise, the render structure is clean and well-organized.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
packages/bruno-app/src/components/ResponsePane/ClearTimeline/index.js(1 hunks)packages/bruno-app/src/components/ResponsePane/ResponseLayoutToggle/index.js(3 hunks)packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/StyledWrapper.js(1 hunks)packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.js(3 hunks)packages/bruno-app/src/components/ResponsePane/StyledWrapper.js(3 hunks)packages/bruno-app/src/components/ResponsePane/index.js(5 hunks)packages/bruno-app/src/ui/ResponsiveTabs/index.js(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/bruno-app/src/components/ResponsePane/ClearTimeline/index.js
- packages/bruno-app/src/components/ResponsePane/ResponseLayoutToggle/index.js
- 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()notfunc ()
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/ResponsePaneActions/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.jspackages/bruno-app/src/ui/ResponsiveTabs/index.jspackages/bruno-app/src/components/ResponsePane/StyledWrapper.js
🧠 Learnings (4)
📚 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/ResponsePaneActions/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.jspackages/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 Component CSS might also change layout but Tailwind classes shouldn't define colors
Applied to files:
packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/StyledWrapper.js
📚 Learning: 2025-12-02T09:45:31.709Z
Learnt from: sid-bruno
Repo: usebruno/bruno PR: 6266
File: packages/bruno-app/src/components/ResponsePane/ResponseCopy/index.js:38-38
Timestamp: 2025-12-02T09:45:31.709Z
Learning: In the ResponseCopy component (packages/bruno-app/src/components/ResponsePane/ResponseCopy/index.js), the copy button is intentionally disabled using `!response.data` to prevent copying stream resets which result in empty strings.
Applied to files:
packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/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} : 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/StyledWrapper.js
🧬 Code graph analysis (2)
packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.js (2)
packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/StyledWrapper.js (1)
StyledWrapper(3-29)packages/bruno-app/src/components/ResponsePane/ResponseLayoutToggle/index.js (2)
orientation(56-56)ResponseLayoutToggle(73-107)
packages/bruno-app/src/ui/ResponsiveTabs/index.js (2)
packages/bruno-app/src/ui/ResponsiveTabs/StyledWrapper.js (1)
StyledWrapper(3-61)packages/bruno-app/src/components/Dropdown/index.js (1)
Dropdown(5-25)
⏰ 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: CLI Tests
- GitHub Check: SSL Tests - Linux
- GitHub Check: SSL Tests - Windows
- GitHub Check: Playwright E2E Tests
- GitHub Check: Unit Tests
- GitHub Check: SSL Tests - macOS
🔇 Additional comments (16)
packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/StyledWrapper.js (1)
1-29: LGTM!The responsive layout approach using parent selector patterns is clean and follows best practices. The default/vertical-layout states are clearly defined.
packages/bruno-app/src/components/ResponsePane/StyledWrapper.js (4)
4-10: LGTM!The overflow and min-width constraints on the wrapper and its first child correctly enable flex shrinking behavior for the responsive layout.
12-22: LGTM!The tab container overflow handling is correct. The previous concern about redundant
overflow-xhas been resolved.
30-33: LGTM!The ellipsis styling for tabs is correctly implemented, enabling proper text truncation when tabs shrink in the responsive layout.
52-68: LGTM!The flex helper classes correctly define container behavior: right-side-container expands to fill space, while status and actions maintain minimum sizing.
packages/bruno-app/src/components/ResponsePane/ResponsePaneActions/index.js (3)
1-10: LGTM!Import cleanup removes unused hooks, and the new StyledWrapper scoping plus useResponseLayoutToggle hook provide cleaner separation of concerns.
40-56: LGTM!Component setup is clean, with proper hook usage and appropriate early return for unsupported item types.
59-113: LGTM!The dropdown structure is well-organized, and the icon logic correctly shows the opposite layout orientation (vertical→columns, horizontal→rows) to indicate the target state.
packages/bruno-app/src/ui/ResponsiveTabs/index.js (8)
1-10: LGTM!Imports and constants are well-organized and follow conventions.
17-30: LGTM!Component signature and state/ref initialization are clean and follow React best practices.
32-38: LGTM!Proper memoization and safe ref access with optional chaining.
83-90: LGTM!Good use of conditional delay and requestAnimationFrame for smooth visual updates. Proper cleanup of timeout.
93-113: Verify that rightContent size changes don't need to trigger recalculation.The ResizeObserver only watches the tabs container, not the rightContent element. If
rightContentchanges size dynamically, the available width for tabs won't update automatically, potentially causing incorrect tab visibility.Confirm whether rightContent is expected to have a fixed size, or if dynamic size changes should trigger tab recalculation. If the latter, consider observing
rightContentRefas well (while being careful about potential feedback loops).
116-139: LGTM!Good cleanup of stale refs and appropriate use of memoization for performance optimization.
141-173: LGTM!Proper use of ARIA attributes for accessibility and clean conditional rendering for dropdown vs visible tabs.
12-15: [rewritten comment]
[classification tag]
* refactor: used common component for layout switching button * refactor: replace RequestPaneTabs with ResponsiveTabs component across RequestPane and HttpRequestPane * refactor: simplify ResponsePaneActions component and improve layout handling * refactor: enhance ResponsePane component with improved tab handling and layout adjustments * refactor: update layout toggle functionality and button labels in ResponsePane components * refactor: ensure consistent action button selection in response actions
Description
RequestPaneTabscomponent and migrated all usages to the new genericui/ResponsiveTabscomponentIconLayoutColumns,IconLayoutRows) instead of custom icons in Response Options.useCallbackto prevent unnecessary re-rendersContribution 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
UI/Style Improvements
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.