Skip to content

feat(network-columns-resize)/added resizable columns in network panel - #8265

Merged
sid-bruno merged 4 commits into
usebruno:mainfrom
sachin-thakur-bruno:feat/resize-network-columns
Jun 23, 2026
Merged

sid-bruno merged 4 commits into
usebruno:mainfrom
sachin-thakur-bruno:feat/resize-network-columns

Conversation

@sachin-thakur-bruno

@sachin-thakur-bruno sachin-thakur-bruno commented Jun 15, 2026 •

Copy link
Copy Markdown
Collaborator

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.

  • useResizableColumns hook — new reusable hook that manages column widths in px, measures the container via ResizeObserver, and scales all columns proportionally on container resize. Adjacent-column resize (left grows ↔ right shrinks) with a hard stop at MIN_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

  • Total width always equals container width — no horizontal scroll.
  • Dragging only affects the two columns around the grabbed separator.
  • Columns scale proportionally when the panel is resized.
  • Separator styling matches the existing Request Details drag handle (sidebar.dragbar.border / sidebar.dragbar.activeBorder).

Network Tab: Persist Sort Config

NetworkTab/index.js

Sort column and direction were stored in local component state (useState), so they reset every time the devtools panel was closed. Replaced with usePersistedState keyed to devtools-network-sort.

Bug Fix: Details Panel Dismissed on Tab Switch

slices/logs.js

setActiveTab was unconditionally nulling selectedRequest whenever 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.js

Panel 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 to usePersistedState keyed to devtools-details-panel-width.

Removed from Redux:

  • requestDetailsPanelWidth initial state field
  • updateRequestDetailsPanelWidth reducer and export

Tests

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:

  • 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

  • New Features
    • Added draggable column separators to resize Network tab columns.
  • Improvements
    • Enhanced Network tab sorting (method, status, domain/path, time/duration, size) with preferences persisted.
    • Refreshed Network tab layout/styling for a more consistent grid/table feel, including better scrolling, truncation, and resizing visuals.
    • Persist the Console details panel width locally.
  • Tests
    • Added/expanded coverage for column resizing (including min-width edge cases) and NetworkTab persistence behavior.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Adds a new useResizableColumns React hook that measures container width via ResizeObserver, proportionally scales column widths, and handles drag-to-resize with min-width clamping and persistence callbacks. NetworkTab integrates the hook with persisted sort and column widths via usePersistedState. Redux's logs slice removes requestDetailsPanelWidth state; Console migrates panel width persistence to local storage. utils.js swaps grid helpers for request-sorting utilities, and StyledWrapper CSS is updated for resize visuals and text truncation.

Changes

Resizable Columns and Persisted Devtools UI State

Layer / File(s) Summary
useResizableColumns hook: measurement, scaling, and drag logic
src/hooks/useResizableColumns/index.js
New hook with grid-template builders, proportional width scaling, ResizeObserver-based measurement with initialWidths support, and document-level drag handlers that clamp adjacent columns against minColWidth and fire onResizeEnd callback.
useResizableColumns tests
src/hooks/useResizableColumns/index.spec.js
Jest suite with ResizeObserver mock covers fallback state, proportional measurement, zero-width guard, proportional rescale on resize, adjacent-column redistribution, min-width absorption, resizingIdx lifecycle, and unmount-during-drag safety.
NetworkTab utils: remove grid helpers, add sort helpers
src/components/Devtools/Console/NetworkTab/utils.js
Removes getGridTemplate/getSeparatorPositions; adds getSortValue with URL-parsing fallbacks and sortRequests for asc/desc column sorting.
NetworkTab: hook wiring, persisted sort/widths, and resize-aware rendering
src/components/Devtools/Console/NetworkTab/index.js, index.spec.js
Updates COLUMNS widths to numeric values, calls useResizableColumns with initialWidths from localStorage and onResizeEnd callback, persists both sortConfig and column widths, refactors click handlers, attaches containerRef with conditional is-resizing class, renders resize-aware separators with handleResizeStart on onMouseDown, clears localStorage between tests.
Redux logs slice: remove panel width state
src/providers/ReduxStore/slices/logs.js, logs.spec.js
Introduces MAX_LOGS/MAX_DEBUG_ERRORS module constants, removes requestDetailsPanelWidth state and updateRequestDetailsPanelWidth action, simplifies setActiveTab to only update tab without clearing selections, adds test coverage for selectedRequest persistence across tab switches.
Console: migrate details panel width to usePersistedState
src/components/Devtools/Console/index.js
Removes Redux requestDetailsPanelWidth usage, imports usePersistedState, persists panel width locally under devtools-details-panel-width (default 400), and calls setter directly on resize.
StyledWrapper CSS: flex scroll, separator UX, and text truncation
src/components/Devtools/Console/NetworkTab/StyledWrapper.js
Adds min-height: 0 for flex scroll containment, reworks .requests-header padding and child truncation, redesigns .col-separator with resize cursor and hover-colored ::after line, enforces text-overflow: ellipsis and white-space: nowrap on row cells, adds .text-right helper.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~28 minutes

Possibly related PRs

  • usebruno/bruno#8238: Directly overlaps on StyledWrapper.js, NetworkTab/index.js, and utils.js—both PRs modify col-separator behavior, header-cell layout, and sorting utilities in the same NetworkTab component.
  • usebruno/bruno#8234: Both PRs touch request details panel resizing state; the retrieved PR added requestDetailsPanelWidth state while this PR removes it and switches to usePersistedState-backed persistence.

Suggested reviewers

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

Poem

Columns now glide and flex with grace,
Separators draggable, widths hold place. 🖱️
ResizeObserver watches the frame,
Zero-sum clamping keeps them the same.
Redux steps back—localStorage takes the reign! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main feature addition—resizable columns in the network panel—which aligns with the PR's primary objective of implementing drag-to-resize column support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@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: 3

🧹 Nitpick comments (1)
packages/bruno-app/src/hooks/useResizableColumns/index.spec.js (1)

72-131: ⚡ Quick win

Add a regression test for undersized container widths.

Please add a case where containerWidth < minColWidth * columnCount and assert that the resulting colWidths still 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

📥 Commits

Reviewing files that changed from the base of the PR and between b73bf9d and 36f32c8.

📒 Files selected for processing (5)
  • packages/bruno-app/src/components/Devtools/Console/NetworkTab/StyledWrapper.js
  • packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js
  • packages/bruno-app/src/components/Devtools/Console/NetworkTab/utils.js
  • packages/bruno-app/src/hooks/useResizableColumns/index.js
  • packages/bruno-app/src/hooks/useResizableColumns/index.spec.js
💤 Files with no reviewable changes (1)
  • packages/bruno-app/src/components/Devtools/Console/NetworkTab/utils.js

@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.

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 win

Add onResizeEnd to the dependency array.

The handleResizeStart callback uses onResizeEnd inside the nested onMouseUp closure 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9cd98b2 and e499903.

📒 Files selected for processing (3)
  • packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js
  • packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.spec.js
  • packages/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

@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

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between e499903 and b170f6d.

📒 Files selected for processing (6)
  • packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js
  • packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.spec.js
  • packages/bruno-app/src/components/Devtools/Console/index.js
  • packages/bruno-app/src/hooks/useResizableColumns/index.js
  • packages/bruno-app/src/providers/ReduxStore/slices/logs.js
  • packages/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

@sid-bruno
sid-bruno merged commit 7adbc6b into usebruno:main Jun 23, 2026
17 of 19 checks passed
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