Skip to content

Keep usage overflow chip width stable as hidden count changes - #26873

Merged
AmethystLiang merged 1 commit into
mainfrom
fix-bottom-bar-resizing
Oct 9, 2026
Merged

AmethystLiang merged 1 commit into
mainfrom
fix-bottom-bar-resizing

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​104 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​103
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​9 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​7

Problem

The status bar has a small badge that says how many usage meters are hidden, like "+3". When the window is narrow, the bar keeps measuring itself to decide what fits. The badge changed width each time its number changed (for example "+9" to "+10"). That width change made the bar re-measure, which could restart the fitting process and cause repeated layout updates.

Solution

The badge now reserves room for the largest count it can show. It draws an invisible copy of the total provider count on the same grid cell as the visible number, so its width stays the same as the hidden count changes. The visible number is unchanged. This is a partial fix: it covers the badge width change, and the e2e test added here covers the narrow-to-wide resize path. I have not confirmed it removes every source of the resize loop.

Mechanism

  • UsageOverflowChip takes a new providerCount prop. StatusBarSurface passes the roster length.
  • The badge switches from inline-flex to inline-grid. The hidden placeholder and the visible text share cell 1/1, so the grid sizes to the placeholder.
  • The cursor usage test is updated for the new prop.
  • A new Playwright test, tests/e2e/status-bar-density-overflow.spec.ts, loads 10 providers, resizes from wide to narrow to wide, checks the badge width stays fixed, and fails on React "Maximum update depth" or error fix: improve scrollbar and file explorer scroll behavior #185.

Why This Approach

A fixed pixel width would look wrong at larger counts and would not follow the text size. Reserving the widest text with an invisible copy keeps the existing style and needs no measurement.

Testing

  • I manually tested these changes locally: TODO
  • Automated tests added/updated: the new e2e spec and the updated cursor usage test. Not yet run in this review: TODO
  • Platforms tested: TODO

Visual Proof

TODO: attach before/after screenshots or a video of the status bar at narrow and wide widths.

Linked Issue

None linked. TODO.

AI Disclosure

TODO

Review

Agent skill upstream boundary

  • Not applicable. This change does not copy or translate any upstream skill-installer source.

Notes

Checked against security, cross-platform, remote SSH, mobile, backwards compatibility, and performance: TODO. No remote wire or persisted data changes are in this diff.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Before/after screenshots or videos attached for UI changes: TODO
  • Self-reviewed for correctness, security, and performance: TODO
  • Cross-platform, SSH/remote, and path/shortcut impact considered: TODO
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass: TODO

The "+N" overflow chip in the status bar changed width whenever its count changed, so the density probe that decides how many usage chips fit kept re-measuring. Reserve the width of the provider-count label with an invisible sizer span, so the chip keeps the same size across counts.

- Pass the total provider count into UsageOverflowChip and render it in an invisible, grid-stacked sizer span.
- Overlay the visible "+N" label on the same grid cell so the chip width tracks the total, not the hidden subset.
- Add an e2e test that loads ten usage providers, shrinks the viewport to collapse them, and checks the chip width stays stable and no "Maximum update depth" or React #185 errors occur.
@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dd3480ce-e241-4fd7-abd9-e7479873c2ca

📥 Commits

Reviewing files that changed from the base of the PR and between 22534fe and 74356ff.


📒 Files selected for processing (4)
  • src/renderer/src/components/status-bar/StatusBarProviderSegment.tsx
  • src/renderer/src/components/status-bar/StatusBarSurface.tsx
  • src/renderer/src/components/status-bar/cursor-usage-headline.test.tsx
  • tests/e2e/status-bar-density-overflow.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.



📝 Walkthrough

Walkthrough

UsageOverflowChip now receives the total provider count and uses it to reserve badge width. Its visible count remains based on the number of hidden providers. A new end-to-end test checks status-bar density at viewport widths from 180 to 1800 pixels.


Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 74356

No merge-blocking issue is established. Run the new end-to-end test during normal validation.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check Warning The description explains the problem, solution, mechanism, and scope. However, it is largely incomplete against the required template: it lacks an ELI5 section, provides no linked issue, leaves visual… Add the required ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, AI Disclosure, Review, Notes, and Checklist information. Provide the actual issue link, attach before-and-after UI evidence or explain why it is not needed, docu…
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: keeping the usage overflow chip width stable when the hidden count changes.
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.

Full details: Description check

Explanation

The description explains the problem, solution, mechanism, and scope. However, it is largely incomplete against the required template: it lacks an ELI5 section, provides no linked issue, leaves visual proof and testing as TODO, leaves AI disclosure unresolved, and does not complete the review, notes, and checklist sections.

Resolution

Add the required ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, AI Disclosure, Review, Notes, and Checklist information. Provide the actual issue link, attach before-and-after UI evidence or explain why it is not needed, document completed tests and platforms, and replace all TODO markers with confirmed details.



  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@AmethystLiang
AmethystLiang merged commit c9c6a00 into main Oct 9, 2026
37 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant