Repository navigation
feat(network-columns-resize)/added resizable columns in network panel - #8265
Conversation
WalkthroughAdds a new ChangesResizable Columns and Persisted Devtools UI State
Sequence Diagram(s)sequenceDiagram
participant User
participant NetworkTab
participant Hook as useResizableColumns
participant localStorage
Note over NetworkTab: Mount
NetworkTab->>localStorage: get persisted sortConfig, column widths
NetworkTab->>Hook: call hook with initialWidths, onResizeEnd
Hook->>NetworkTab: containerRef, gridTemplateColumns, separatorPositions
NetworkTab->>NetworkTab: attach containerRef, render with grid layout
User->>NetworkTab: click header cell
NetworkTab->>localStorage: persist new sortConfig
User->>NetworkTab: mousedown on separator
NetworkTab->>Hook: handleResizeStart(idx, event)
Hook->>Hook: addEventListener mousemove/mouseup on document
NetworkTab->>NetworkTab: is-resizing class applied
User->>Hook: mousemove drag
Hook->>Hook: clamp delta between adjacent cols, setColWidths
Hook->>NetworkTab: gridTemplateColumns updated
User->>Hook: mouseup
Hook->>Hook: onResizeEnd(finalColWidths) callback
Hook->>localStorage: persist column widths
Hook->>NetworkTab: resizingIdx cleared, is-resizing removed
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~28 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: 3
🧹 Nitpick comments (1)
packages/bruno-app/src/hooks/useResizableColumns/index.spec.js (1)
72-131: ⚡ Quick winAdd a regression test for undersized container widths.
Please add a case where
containerWidth < minColWidth * columnCountand assert that the resultingcolWidthsstill sum exactly to the container width. This guards the most failure-prone path in the scaler.✅ Suggested test addition
describe('container measurement', () => { + it('keeps total equal to container width when container is narrower than min-width budget', () => { + setup({ defaultWidths: [200, 200, 200], minColWidth: 60 }); + + act(() => { + triggerResize(120); + }); + + expect(hookValue.colWidths.reduce((s, w) => s + w, 0)).toBe(120); + }); + it('columns sum to container width after first measurement', () => { setup(); const total = hookValue.colWidths.reduce((s, w) => s + w, 0);As per coding guidelines, “Cover both the happy path and the realistically problematic paths.”
🤖 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 `@packages/bruno-app/src/hooks/useResizableColumns/index.spec.js` around lines 72 - 131, Add a new test case within the "container measurement" describe block to cover the regression scenario where the container width is less than the product of minimum column width and column count. In this test, set up a scenario where containerWidth is undersized relative to minColWidth * columnCount, then verify that the resulting colWidths array still sums exactly to the container width. This guards against failure in the scaling logic when handling constrained container dimensions. Follow the pattern established by the existing tests in this describe block, using setup(), act(), and expect() assertions.Source: Coding guidelines
🤖 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 `@packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js`:
- Around line 236-243: The interactive resize separator elements created in the
separatorPositions.map() function lack stable data-testid attributes, making
them difficult to select reliably in E2E tests. Add a data-testid attribute to
the div element with className col-separator, using a deterministic value such
as a combination of a base identifier (e.g., "col-separator") and the index i
(e.g., data-testid={`col-separator-${i}`}) to ensure each separator has a
unique, predictable test id that does not depend on class or style changes.
In `@packages/bruno-app/src/hooks/useResizableColumns/index.js`:
- Around line 83-119: The mousemove and mouseup event listeners attached to the
document in the handleResizeStart function are only cleaned up when onMouseUp
fires. If the component unmounts while a drag is in progress, these listeners
remain attached to the document, causing stale closures to persist and fire
indefinitely. Add a useEffect hook with a cleanup function that removes any
lingering mousemove and mouseup listeners when the component unmounts, ensuring
these document-level listeners are always properly removed regardless of whether
the drag operation completed or was interrupted by unmount.
- Around line 36-41: The scaleWidthsToTotal function fails to handle cases where
the container is too narrow to accommodate the minimum width constraints for all
columns, which can result in a total width exceeding targetTotal and breaking
the layout. Add a check at the beginning of the function to detect when
minColWidth multiplied by the number of columns exceeds targetTotal. When this
unsatisfiable constraint is detected, implement a fallback strategy that
distributes the available targetTotal space proportionally among all columns
(reducing each column's allocation from its minimum width as needed) to ensure
the returned total exactly equals targetTotal without exceeding container
bounds. Ensure the final result from scaleWidthsToTotal always respects the
targetTotal constraint.
---
Nitpick comments:
In `@packages/bruno-app/src/hooks/useResizableColumns/index.spec.js`:
- Around line 72-131: Add a new test case within the "container measurement"
describe block to cover the regression scenario where the container width is
less than the product of minimum column width and column count. In this test,
set up a scenario where containerWidth is undersized relative to minColWidth *
columnCount, then verify that the resulting colWidths array still sums exactly
to the container width. This guards against failure in the scaling logic when
handling constrained container dimensions. Follow the pattern established by the
existing tests in this describe block, using setup(), act(), and expect()
assertions.
🪄 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: 1d1d147e-7c7d-4c17-8c88-1be605807d80
📒 Files selected for processing (5)
packages/bruno-app/src/components/Devtools/Console/NetworkTab/StyledWrapper.jspackages/bruno-app/src/components/Devtools/Console/NetworkTab/index.jspackages/bruno-app/src/components/Devtools/Console/NetworkTab/utils.jspackages/bruno-app/src/hooks/useResizableColumns/index.jspackages/bruno-app/src/hooks/useResizableColumns/index.spec.js
💤 Files with no reviewable changes (1)
- packages/bruno-app/src/components/Devtools/Console/NetworkTab/utils.js
There was a problem hiding this comment.
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/useResizableColumns/index.js (1)
147-147: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAdd
onResizeEndto the dependency array.The
handleResizeStartcallback usesonResizeEndinside the nestedonMouseUpclosure but doesn't include it in the dependency array, which violates the exhaustive-deps rule and could cause stale closures if the callback identity changes.🔧 Suggested fix
- }, [colWidths, minColWidth]); + }, [colWidths, minColWidth, onResizeEnd]);🤖 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 `@packages/bruno-app/src/hooks/useResizableColumns/index.js` at line 147, The `handleResizeStart` function uses the `onResizeEnd` callback within its nested `onMouseUp` closure, but `onResizeEnd` is missing from the useCallback dependency array. Add `onResizeEnd` to the dependency array alongside `colWidths` and `minColWidth` to satisfy the exhaustive-deps rule and ensure the closure captures the correct callback reference when the prop changes.
🤖 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 `@packages/bruno-app/src/hooks/useResizableColumns/index.js`:
- Line 147: The `handleResizeStart` function uses the `onResizeEnd` callback
within its nested `onMouseUp` closure, but `onResizeEnd` is missing from the
useCallback dependency array. Add `onResizeEnd` to the dependency array
alongside `colWidths` and `minColWidth` to satisfy the exhaustive-deps rule and
ensure the closure captures the correct callback reference when the prop
changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1a082880-c704-4424-b32c-d3a1f3a3b6e8
📒 Files selected for processing (3)
packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.jspackages/bruno-app/src/components/Devtools/Console/NetworkTab/index.spec.jspackages/bruno-app/src/hooks/useResizableColumns/index.js
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@packages/bruno-app/src/components/Devtools/Console/index.js`:
- Around line 389-397: The savedDetailsPanelWidth value from usePersistedState
may contain any JSON value from localStorage, which could cause invalid
calculations in useResizablePanel if passed directly as initialWidth. Validate
and normalize the savedDetailsPanelWidth value to ensure it is a valid number
and falls within the MIN_DETAILS_PANEL_WIDTH and MAX_DETAILS_PANEL_WIDTH bounds
before passing it to the useResizablePanel hook. Add a guard that checks if the
value is a number and clamps it to the valid range, using this normalized value
as the initialWidth prop instead of the raw persisted value.
🪄 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: 84bfc3e6-fb5b-4a17-9527-11af9efb308a
📒 Files selected for processing (6)
packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.jspackages/bruno-app/src/components/Devtools/Console/NetworkTab/index.spec.jspackages/bruno-app/src/components/Devtools/Console/index.jspackages/bruno-app/src/hooks/useResizableColumns/index.jspackages/bruno-app/src/providers/ReduxStore/slices/logs.jspackages/bruno-app/src/providers/ReduxStore/slices/logs.spec.js
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/bruno-app/src/hooks/useResizableColumns/index.js
- packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js
Description
The network tab table columns in dev tools have static columns width. Extending the existing table columns to be resizable and persisting the user preference in local storage.
JIRA
Adds drag-to-resize column support to the Devtools Network Tab.
useResizableColumnshook — new reusable hook that manages column widths inpx, measures the container viaResizeObserver, and scales all columns proportionally on container resize. Adjacent-column resize (left grows ↔ right shrinks) with a hard stop atMIN_COL_WIDTH = 60px.NetworkTab— wired up to the hook; separator divs span the full table height as drag handles.utils.js— cleaned up; grid/separator helpers moved into the hook.Behavior
sidebar.dragbar.border/sidebar.dragbar.activeBorder).Network Tab: Persist Sort Config
NetworkTab/index.jsSort column and direction were stored in local component state (
useState), so they reset every time the devtools panel was closed. Replaced withusePersistedStatekeyed todevtools-network-sort.Bug Fix: Details Panel Dismissed on Tab Switch
slices/logs.jssetActiveTabwas unconditionally nullingselectedRequestwhenever the user navigated away from the Network tab. This meant the request details panel was always lost on tab switches, even though it should survive.Request Details Panel: Migrate Width from Redux to localStorage
Console/index.js·slices/logs.jsPanel width was stored in Redux state (
requestDetailsPanelWidth) and persisted via a dedicated action (updateRequestDetailsPanelWidth). Since this is purely UI preference with no cross-component dependencies, it's been moved tousePersistedStatekeyed todevtools-details-panel-width.Removed from Redux:
requestDetailsPanelWidthinitial state fieldupdateRequestDetailsPanelWidthreducer and exportTests
18 tests covering initial state, container measurement, proportional rescaling, adjacent-column drag, hard-stop conservation, and unmount cleanup.
Screen.Recording.2026-06-15.at.2.29.58.PM.mov
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