Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughNetwork Tab was refactored to a grid-driven request table with a COLUMNS config, client-side sorting (cycle: none → asc → desc), computed grid templates/separator positions, updated header/cell/row styling, Jest test shims, and RTL tests validating sort state and ordering. ChangesNetwork Tab Grid Layout and Sorting
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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: 1
🧹 Nitpick comments (2)
packages/bruno-app/src/components/Devtools/Console/NetworkTab/StyledWrapper.js (1)
177-215: 💤 Low valueRedundant padding values on
.request-size.Line 210 specifies
padding: 2px 8px 2px 8px;which is equivalent topadding: 2px 8px;.✨ Simplification
.request-size { - padding: 2px 8px 2px 8px; + padding: 2px 8px; color: ${(props) => props.theme.console.messageColor};🤖 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/components/Devtools/Console/NetworkTab/StyledWrapper.js` around lines 177 - 215, The .request-size rule contains redundant padding shorthand (padding: 2px 8px 2px 8px); update the CSS in StyledWrapper.js by replacing that value with the simplified equivalent padding: 2px 8px; so the .request-size selector matches the other rules and removes unnecessary duplication.packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js (1)
249-275: ⚡ Quick winAdd
data-testidattributes for Playwright tests.According to Bruno coding guidelines, testable elements should include
data-testidfor E2E tests. The header cells and request rows are interactive elements that would benefit from test identifiers.🧪 Suggested additions
For header cells:
<div key={col.key} className={`header-cell${col.align === 'right' ? ' text-right' : ''}`} onClick={() => handleHeaderClick(col.key)} + data-testid={`network-header-${col.key}`} >For request rows:
<div className={`request-row ${isSelected ? 'selected' : ''}`} onClick={onClick} style={{ gridTemplateColumns }} + data-testid="network-request-row" >🤖 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/components/Devtools/Console/NetworkTab/index.js` around lines 249 - 275, Add data-testid attributes to the header cells and request rows so Playwright can target them: in the header map where COLUMNS is rendered (the div that calls handleHeaderClick and references sortConfig.key/col.key) add a data-testid like `data-testid={"network-header-"+col.key}`; in the requests list where sortedRequests are mapped to the RequestRow component (the JSX that passes request, isSelected, onClick via handleRequestClick, gridTemplateColumns) add a data-testid prop (e.g., `data-testid={"network-request-"+request.itemUid+"-"+request.timestamp}`) or wrap the row root div with that attribute so tests can reliably select rows. Ensure test ids are unique and stable (use request.itemUid/timestamp or col.key) and propagate them through RequestRow if necessary.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 249-264: The header-cell markup conditionally adds a text-right
class (in NetworkTab's header render where COLUMNS are mapped, using
handleHeaderClick and sortConfig) but StyledWrapper.js lacks a definition for
.text-right; add a .text-right rule inside the .header-cell styles in
StyledWrapper.js to right-align content (so Duration and Size columns render
correctly) and ensure it applies to the span/text within the header-cell.
---
Nitpick comments:
In `@packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js`:
- Around line 249-275: Add data-testid attributes to the header cells and
request rows so Playwright can target them: in the header map where COLUMNS is
rendered (the div that calls handleHeaderClick and references
sortConfig.key/col.key) add a data-testid like
`data-testid={"network-header-"+col.key}`; in the requests list where
sortedRequests are mapped to the RequestRow component (the JSX that passes
request, isSelected, onClick via handleRequestClick, gridTemplateColumns) add a
data-testid prop (e.g.,
`data-testid={"network-request-"+request.itemUid+"-"+request.timestamp}`) or
wrap the row root div with that attribute so tests can reliably select rows.
Ensure test ids are unique and stable (use request.itemUid/timestamp or col.key)
and propagate them through RequestRow if necessary.
In
`@packages/bruno-app/src/components/Devtools/Console/NetworkTab/StyledWrapper.js`:
- Around line 177-215: The .request-size rule contains redundant padding
shorthand (padding: 2px 8px 2px 8px); update the CSS in StyledWrapper.js by
replacing that value with the simplified equivalent padding: 2px 8px; so the
.request-size selector matches the other rules and removes unnecessary
duplication.
🪄 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: 33d20c83-64ca-4284-a182-fb8dcdc1daf7
📒 Files selected for processing (2)
packages/bruno-app/src/components/Devtools/Console/NetworkTab/StyledWrapper.jspackages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (3)
packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.spec.js (1)
136-139: ⚡ Quick winReplace class-based DOM queries with stable test selectors.
Line 138 and Line 173 rely on
.method-badge/.status-badge. These are styling-coupled and brittle. Preferdata-testid/role-based selectors so tests stay behavioral when class names change.As per coding guidelines, brittle selectors should be replaced with role/label/test id or other stable user-facing selectors.
Also applies to: 172-174
🤖 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/components/Devtools/Console/NetworkTab/index.spec.js` around lines 136 - 139, The test's DOM queries inside getRowMethods (and the similar status lookup) use fragile class selectors '.method-badge' and '.status-badge'; update these to stable test selectors by changing the component to add data-testid attributes (e.g., data-testid="network-method" / data-testid="network-status") and modify the test to use screen.getAllByTestId('network-request-row').map(row => row.querySelector('[data-testid="network-method"]')?.textContent) or use role/label queries instead; locate getRowMethods and the corresponding status extraction in the spec and replace class-based querySelector calls with data-testid or role-based selectors to make the tests resilient to styling changes.Source: Coding guidelines
packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js (1)
49-93: ⚡ Quick winExtract helper functions to module level.
These six pure functions (
formatTime,formatDuration,formatSize,getUrl,getDomain,getPath) are recreated on every render of everyRequestRow. Since they don't depend on component state or hooks, extract them outside the component to reduce allocations.♻️ Proposed refactor
Move the functions above the
RequestRowcomponent definition:+const formatTime = (timestamp) => { + const date = new Date(timestamp); + return date.toLocaleTimeString('en-US', { + hour12: false, + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + fractionalSecondDigits: 3 + }); +}; + +const formatDuration = (duration) => { + if (!duration) return '-'; + if (duration < 1000) return `${Math.round(duration)}ms`; + return `${(duration / 1000).toFixed(2)}s`; +}; + +const formatSize = (size) => { + if (!size) return '-'; + if (size < 1024) return `${size}B`; + if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)}KB`; + return `${(size / (1024 * 1024)).toFixed(1)}MB`; +}; + +const getUrl = (req) => req?.url || 'Unknown URL'; + +const getDomain = (req) => { + try { + const url = new URL(getUrl(req)); + return url.hostname; + } catch { + return getUrl(req); + } +}; + +const getPath = (req) => { + try { + const url = new URL(getUrl(req)); + return url.pathname + url.search; + } catch { + return getUrl(req); + } +}; + const RequestRow = ({ request, isSelected, onClick, gridTemplateColumns }) => { const { data } = request; const { request: req, response: res, timestamp } = data; - const formatTime = (timestamp) => { - const date = new Date(timestamp); - return date.toLocaleTimeString('en-US', { - hour12: false, - hour: '2-digit', - minute: '2-digit', - second: '2-digit', - fractionalSecondDigits: 3 - }); - }; - - const formatDuration = (duration) => { - if (!duration) return '-'; - if (duration < 1000) return `${Math.round(duration)}ms`; - return `${(duration / 1000).toFixed(2)}s`; - }; - - const formatSize = (size) => { - if (!size) return '-'; - if (size < 1024) return `${size}B`; - if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)}KB`; - return `${(size / (1024 * 1024)).toFixed(1)}MB`; - }; - - const getUrl = () => { - return req?.url || 'Unknown URL'; - }; - - const getDomain = () => { - try { - const url = new URL(getUrl()); - return url.hostname; - } catch { - return getUrl(); - } - }; - - const getPath = () => { - try { - const url = new URL(getUrl()); - return url.pathname + url.search; - } catch { - return getUrl(); - } - }; - return ( <div className={`request-row ${isSelected ? 'selected' : ''}`} onClick={onClick} style={{ gridTemplateColumns }} data-testid="network-request-row" > <div className="request-method"> <MethodBadge method={req?.method} /> </div> <div className="request-status"> <StatusBadge status={res?.status} statusCode={res?.statusCode} /> </div> - <div className="request-domain" title={getDomain()}> - {getDomain()} + <div className="request-domain" title={getDomain(req)}> + {getDomain(req)} </div> - <div className="request-path" title={getPath()}> - {getPath()} + <div className="request-path" title={getPath(req)}> + {getPath(req)} </div> <div className="request-time"> {formatTime(timestamp)} </div> <div className="request-duration"> {formatDuration(res?.duration)} </div> <div className="request-size"> {formatSize(res?.size)} </div> </div> ); };🤖 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/components/Devtools/Console/NetworkTab/index.js` around lines 49 - 93, Extract the six pure helpers (formatTime, formatDuration, formatSize, getUrl, getDomain, getPath) out of the RequestRow component to module scope to avoid recreating them on every render; move their definitions above the RequestRow declaration and update getUrl/getDomain/getPath to accept a req (or url) argument instead of closing over req so callers inside RequestRow pass the request (e.g., req) into getUrl/getDomain/getPath; ensure signatures remain consistent and update any internal calls in RequestRow to use the new parameterized helpers.packages/bruno-app/src/components/Devtools/Console/NetworkTab/utils.js (1)
4-25: ⚡ Quick winAdd JSDoc to explain the separator positioning algorithm.
This function implements non-trivial logic for computing separator positions between mixed fixed/auto-width columns. As per coding guidelines, complex code should include documentation to aid future maintainers.
📝 Proposed JSDoc
+/** + * Computes the left/right pixel positions for column separators. + * For columns with fixed widths, separators are positioned from the left. + * For columns with auto widths (null), separators are positioned from the right. + * `@param` {Array} columns - Array of column definitions with width property + * `@returns` {Array} Array of position objects with {left: px} or {right: px} or null + */ export const getSeparatorPositions = (columns) => { const n = columns.length;🤖 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/components/Devtools/Console/NetworkTab/utils.js` around lines 4 - 25, Add a JSDoc block to getSeparatorPositions describing purpose, parameters, return value and algorithm: state that it computes separator positions for n-1 separators given an array of column objects (each with width which may be number or null), explain the left-to-right pass that records absolute left offsets until an auto-width (null) column, the right-to-left pass that records absolute right offsets until an auto-width column and only fills gaps where left pass didn't set a position, and clarify the returned array format (length n-1 with entries null or objects {left: number} or {right: number}); include param types for columns and the exact shape of the returned positions for future maintainers and tooling.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.spec.js`:
- Around line 12-29: The tests overwrite globals (global.ResizeObserver and
window.matchMedia in the beforeAll block) but never restore them; save the
original references (e.g., const _origResizeObserver = global.ResizeObserver and
const _origMatchMedia = window.matchMedia) before mocking and restore them in an
afterAll cleanup (or set them back to undefined if originally undefined) so the
mocks do not leak to other suites; update the beforeAll/afterAll surrounding the
ResizeObserver assignment and the matchMedia Object.defineProperty to perform
this save/restore.
In `@packages/bruno-app/src/components/Devtools/Console/NetworkTab/utils.js`:
- Around line 27-46: getSortValue currently returns the HTTP method raw for the
'method' key, causing case-sensitive sorting; update the 'method' branch in
getSortValue to normalize the method string (e.g., use
req?.method?.toUpperCase() or .toLowerCase() with a fallback '') so comparisons
are case-insensitive and consistent across mixed-case inputs; modify the
'method' case in
packages/bruno-app/src/components/Devtools/Console/NetworkTab/utils.js to return
the normalized method instead of req?.method.
---
Nitpick comments:
In `@packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.js`:
- Around line 49-93: Extract the six pure helpers (formatTime, formatDuration,
formatSize, getUrl, getDomain, getPath) out of the RequestRow component to
module scope to avoid recreating them on every render; move their definitions
above the RequestRow declaration and update getUrl/getDomain/getPath to accept a
req (or url) argument instead of closing over req so callers inside RequestRow
pass the request (e.g., req) into getUrl/getDomain/getPath; ensure signatures
remain consistent and update any internal calls in RequestRow to use the new
parameterized helpers.
In `@packages/bruno-app/src/components/Devtools/Console/NetworkTab/index.spec.js`:
- Around line 136-139: The test's DOM queries inside getRowMethods (and the
similar status lookup) use fragile class selectors '.method-badge' and
'.status-badge'; update these to stable test selectors by changing the component
to add data-testid attributes (e.g., data-testid="network-method" /
data-testid="network-status") and modify the test to use
screen.getAllByTestId('network-request-row').map(row =>
row.querySelector('[data-testid="network-method"]')?.textContent) or use
role/label queries instead; locate getRowMethods and the corresponding status
extraction in the spec and replace class-based querySelector calls with
data-testid or role-based selectors to make the tests resilient to styling
changes.
In `@packages/bruno-app/src/components/Devtools/Console/NetworkTab/utils.js`:
- Around line 4-25: Add a JSDoc block to getSeparatorPositions describing
purpose, parameters, return value and algorithm: state that it computes
separator positions for n-1 separators given an array of column objects (each
with width which may be number or null), explain the left-to-right pass that
records absolute left offsets until an auto-width (null) column, the
right-to-left pass that records absolute right offsets until an auto-width
column and only fills gaps where left pass didn't set a position, and clarify
the returned array format (length n-1 with entries null or objects {left:
number} or {right: number}); include param types for columns and the exact shape
of the returned positions for future maintainers and tooling.
🪄 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: 5ff8a9bd-ee2d-4cc9-9c48-8a3397970741
📒 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/components/Devtools/Console/NetworkTab/utils.js
Description
JIRA
This PR covers the Sorting on the Network tab column.
Screen.Recording.2026-06-11.at.4.25.10.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
New Features
Improvements
Tests