refactor(web): move the /usage-limits panel state out of ChatView #20296
chatview-split/pending-requests-compiled fromrefs/pull/20296/head·merged by juliusmarminge View on GitHubPart of the ChatView split so the React Compiler can compile it.
useUsageLimitsPanel now holds the /usage-limits panel: the open snapshot, the banner, whether the command is offered, and the open/clear actions. ChatView still builds the panel key, because it combines thread, model and pending-request state. The new hook compiles, so it goes on the compile-required lint list (#20292) without manual memoization.
Stack progress#
| Layer | ChatView lines | ChatView component body | Compiler on ChatView | Files held to strict compiler lint |
|---|---|---|---|---|
| main | 11,660 | 10,007 | crashes (internal error) | 0 |
| #20161 pending approvals and questions hook | 11,222 | 9,624 | crashes (internal error) | 0 |
| #20164 terminal drawer and panel file | 10,614 | 9,624 | crashes (internal error) | 0 |
| #20289 one terminal open/close hook | 10,466 | 9,481 | crashes (internal error) | 0 |
| #20292 compile-required lint list | 10,466 | 9,481 | crashes (internal error) | 2 |
| #20294 pending hook compiles | 10,466 | 9,481 | crashes (internal error) | 3 |
| → #20296 /usage-limits panel hook | 10,397 | 9,416 | crashes (internal error) | 4 |
| #20304 queued-message editing hook | 10,172 | 9,200 | crashes (internal error) | 5 |
| #20308 linked pull request hook | 10,078 | 9,106 | crashes (internal error) | 6 |
| #20309 proactive panel hook | 9,950 | 8,984 | crashes (internal error) | 7 |
| #20312 agent-opened previews hook | 9,855 | 8,890 | crashes (internal error) | 8 |
| #20315 right panel close hook | 9,743 | 8,779 | crashes (internal error) | 9 |
| #20316 worktree setup hook | 9,660 | 8,695 | crashes (internal error) | 10 |
| #20321 two onSend phases split out | 9,660 | 8,613 | crashes (internal error) | 10 |
| #20340 compiler no longer crashes on ChatView | 9,647 | 8,599 | skips (32 reasons) | 10 |
| #20379 ChatView compiles | 9,616 | 8,469 | compiles | 11 |
| #20380 re-render fixes from profiling | 9,661 | 8,514 | compiles | 11 |
| #20392 provider pushes keep identity | 9,628 | 8,481 | compiles | 11 |
| #20393 keyboard shortcuts command map | 9,340 | 8,265 | compiles | 13 |
| #20396 Sidebar compiles, no manual memos | 9,340 | 8,265 | compiles | 14 |
| #20397 ChatComposer compiles | 9,340 | 8,265 | compiles | 14 |
| #20401 project script editing hook | 9,110 | 8,049 | compiles | 15 |
| #20402 MessagesTimeline compiles | 9,110 | 8,049 | compiles | 16 |
| #20418 ChatView strict: no memos, no sync effects | 8,901 | 7,855 | compiles | 17 |
Measured with the native React Compiler (oxc-transform-react) on each layer's ChatView.tsx. "Crashes" means it hit an internal codegen error and left ChatView uncompiled; "skips" means it reported reasons it could not compile it. Strict files must compile with no bailouts, no manual memoization and no effect-rule violations; lint and reactCompiledFiles.test.ts enforce it.
🤖 Generated with Claude Code (Claude Opus 5.5)
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
juliusmarminge added labelsmacroscope-review
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Approvability#
Verdict: Approved at
60b278eMacroscope's review found this PR approvable — This is a localized refactor that moves the existing usage-limits panel logic into a hook while preserving its inputs, actions, and display behavior. The accompanying Vite change only strengthens React Compiler checking and does not affect production configuration or product defaults.
No code changes detected at
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).f253553. Prior analysis still applies.No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
ae5e4c50-d186-4cc6-b25d-784b0641e183
📥 Commits
-
Reviewing files that changed from the base of the PR and between 60b278e20fc844761992aabbeae02427bde399d9 and f2535539d2ccac3caf97fb04859a670d6da41d4a.
📒 Files selected for processing: 1
-
apps/web/src/components/ChatView.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
-
📝 Walkthrough
-
ChatView now delegates usage-limit panel state, report collection, banner generation, availability checks, and panel actions to
useUsageLimitsPanel. The hook is added to the React Compiler lint rules.Changes: Usage limits panel
Layer / File(s) Summary Manage usage-limit panel state
apps/web/src/components/chat/useUsageLimitsPanel.tsThe new hook collects usage-limit reports and manages banner visibility, availability, opening, dismissal, and thread-scoped clearing. Integrate the panel hook
apps/web/src/components/ChatView.tsx,vite.config.tsChatView passes thread and provider data to the hook and uses its open action for the composer command. The hook is included in React Compiler lint coverage. Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~15 minutes
Change: Refactor
Suggested reviewers:
t3dotgg
Merge Risk: ⚪ Minimal · up to
f2535-
Usage-limit panel state and actions now live in a hook without an identified change to user-facing behavior. No material merge risk was found; the change appears ready for normal checks.
Pre-merge checks:
3 · 1-
Failed checks: 1 warningCheck name Status Explanation Resolution Description check The description explains the implementation change and compiler context, but it does not provide the required Problem, Scope and approval, or Verification sections. It also lacks focused test results … Add the required Problem, Scope and approval, and Verification sections. Describe the expected behavior and problem, provide the issue or maintainer approval and scope rationale, and list focused tests or manual checks with observed results… Passed checks: 3 passed-
Check name Status Explanation Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Title check The title clearly and concisely describes the primary change: moving the /usage-limitspanel state out ofChatView.
Full details: Description check
-
Explanation
The description explains the implementation change and compiler context, but it does not provide the required Problem, Scope and approval, or Verification sections. It also lacks focused test results or manual-check evidence.
Resolution
Add the required Problem, Scope and approval, and Verification sections. Describe the expected behavior and problem, provide the issue or maintainer approval and scope rationale, and list focused tests or manual checks with observed results. Include UI screenshots if applicable.
-
- Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
🛠️ Fix failing CI checks: 💡
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge merged this65de56e
juliusmarminge closed this
Sign in to join this conversation.
Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result:
f253553· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.