feat: Add usage limit detection and upgrade prompt#1791
Open
charlesvien wants to merge 16 commits intomainfrom
Open
feat: Add usage limit detection and upgrade prompt#1791charlesvien wants to merge 16 commits intomainfrom
charlesvien wants to merge 16 commits intomainfrom
Conversation
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Apr 22, 2026
Prompt To Fix All With AIThis is a comment left during a code review.
Path: apps/code/src/renderer/features/billing/stores/usageLimitStore.ts
Line: 22
Comment:
**Context cleared before close animation completes**
`hide()` sets `context: null` at the same time as `isOpen: false`. Radix UI's `Dialog` plays an exit animation while its content is still mounted, so the description briefly switches from the "mid-task" copy to the "idle" copy mid-animation. Keeping `context` alive until the dialog is fully closed prevents the visual flicker.
```suggestion
hide: () => set({ isOpen: false }),
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: apps/code/src/renderer/components/MainLayout.tsx
Line: 44
Comment:
**Modal can be triggered before it is mounted**
`useUsageLimitDetection()` runs unconditionally while `<UsageLimitModal />` is only rendered when `billingEnabled` is true. A mid-session flag flip from `true → false` leaves `isOpen: true` stranded in the store with no modal to render it. Consider hoisting the flag check to the call site or calling `hide()` when `billingEnabled` turns `false`.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "Update seatStore.test.ts" | Re-trigger Greptile |
694fedc to
ec7e74b
Compare
This reverts commit eb9f1d2.
49b3880 to
ed3eff5
Compare
jonathanlab
approved these changes
Apr 22, 2026
| const hasAlertedRef = useRef(false); | ||
|
|
||
| useEffect(() => { | ||
| if (!billingEnabled || !seatLoaded || isPro || !usage) return; |
Contributor
There was a problem hiding this comment.
nit: I'm seeing this condition replicated in a 5+ spots, it might be worth to extract these checks into their own helper.
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.

Problem
NOTE TO REVIEWER: You might not be able to test this without enabling the feature flag in a SEPERATE org, feel free to yolo stamp.
Free-tier users have no visibility into usage limits until requests start failing silently.
Changes
How did you test this?
Manually