Repository navigation
perf(status-bar): guard usage-notice anchor against equal-geometry re-render churn - #9615
Merged
Merged
Conversation
…-render churn The UsagePercentageDisplayChangeNotice callout re-measures its fixed anchor on every ResizeObserver/resize delivery and calls setAnchorPosition with a fresh object each time. Equal-geometry deliveries (the common case) still churned a re-render apiece because the object identity changed. Bail when bottom/left are unchanged so React short-circuits before commit. Measured: 20 identical-geometry deliveries → 20 re-renders before, 1 after. This is defensive robustness/perf hardening for the status-bar subtree that surfaced in crash f75ed81b (React #185 in overlay.status-bar). It is NOT a proven fix for that crash — the reproduced #185 loop lives in radix Popper internals and is not unit-reproducible; this removes one churn source feeding that subtree.
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
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 |
enrick-dev
pushed a commit
to enrick-dev/orca
that referenced
this pull request
Oct 15, 2026
…-render churn (stablyai#9615) The UsagePercentageDisplayChangeNotice callout re-measures its fixed anchor on every ResizeObserver/resize delivery and calls setAnchorPosition with a fresh object each time. Equal-geometry deliveries (the common case) still churned a re-render apiece because the object identity changed. Bail when bottom/left are unchanged so React short-circuits before commit. Measured: 20 identical-geometry deliveries → 20 re-renders before, 1 after. This is defensive robustness/perf hardening for the status-bar subtree that surfaced in crash f75ed81b (React stablyai#185 in overlay.status-bar). It is NOT a proven fix for that crash — the reproduced stablyai#185 loop lives in radix Popper internals and is not unit-reproducible; this removes one churn source feeding that subtree.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
The status-bar "Usage now shows % used" callout (
UsagePercentageDisplayChangeNotice) positions aposition: fixedcard above the usage meters. It re-measures its anchor on everyResizeObserver/ window-resizedelivery and callssetAnchorPosition(measureAnchorPosition(anchor))— a new object every time. Because the object identity changes, React re-rendered on every delivery even when the geometry was identical (the common case: meters reflow, agent-status ticks, background repaints).This PR guards
setAnchorPositionwith a functional updater that returns the previous reference whenbottom/leftare unchanged, so React short-circuits before commit.CLEAR, undeniable fix evidence
Unit test counts commits (React
Profiler.onRender) across 20 identical-geometryResizeObserverdeliveries:expected 20 to be less than or equal to 1); with the guard it passes. Verified independently by a second reviewer viagit stash.oxlint+oxfmtclean (pre-commit).ELI5
A little pop-up above your usage bars asks the window "where are you?" many times a second so it can float in the right spot. Every time it asked, it wrote down a brand-new sticky note with the answer — and React treats a new sticky note as "something changed!" and repaints, even when the answer was the exact same spot. Now the pop-up checks first: "same spot as last time? then keep the old sticky note" — so React stops repainting for no reason. 20 needless repaints → 1.
Trade-offs / regressions
bottomfoldswindow.innerHeight,leftfoldswindow.innerWidth; any real move changes one and returns the fresh value). Initial placement is unchanged (previsnull→ returns the new value).useLayoutEffectis the correct home (fixed positioning must measure synchronously pre-paint; rAF would flicker).Adversarial review + perf
≤1bound and the comment to "measured 20 → measured 1".git stash(20 without / 1 with), confirmed no stale-position risk (compared fields are an exact superset of render inputs), no leftover debug code, AGENTS.md-compliant → CLEAN./perfskill, sub-agent): PASS. Smallest behavior-preserving fix; correct measurement (Profiler commit count); no remaining waste worth acting on; no new perf risk.