Skip to content

Commit b28307c

Browse files
fix(web): measure the limits bar without a ResizeObserver loop
1 parent b623636 commit b28307c

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎apps/web/src/components/usage/UsageLimitsPooled.tsx‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,8 @@ const LABELED_SEGMENT_MIN_WIDTH = 224;
471471
* When every segment has room, each carries its own label. Otherwise the bar
472472
* is a bare strip and a legend below lists the accounts in the same order;
473473
* both open the same popover. Room depends on the account count as well as
474-
* the bar's width, so the bar measures itself rather than using a container
475-
* query.
474+
* the bar's width, so the bar measures its width rather than using a
475+
* container query.
476476
*/
477477
function PoolBar({
478478
pool,
@@ -494,7 +494,9 @@ function PoolBar({
494494
[columns],
495495
);
496496
return (
497-
<div ref={observeWidth} className="min-w-0">
497+
<div className="min-w-0">
498+
{/* Empty so its size never changes with the layout: measuring the bar itself would loop. */}
499+
<div ref={observeWidth} aria-hidden />
498500
<div
499501
className="grid gap-x-1 gap-y-1"
500502
style={{ gridTemplateColumns: `repeat(${pool.columns.length}, minmax(0, 1fr))` }}

0 commit comments

Comments
 (0)