fix(teams): tier changes not giving proper feedback#2913
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughTeam member tier update flow enhanced with asynchronous mutation handling and optimistic cache updates. The UI component now displays loading and result toasts, while the mutation layer implements optimistic updates with rollback on failure and additional cache invalidations for user info and quota when the current user's tier changes. Changes
Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@js/app/packages/app/component/settings/Team.tsx`:
- Around line 514-527: The call to toast.promise wrapping
patchTierMutation.mutateAsync(...) produces an unhandled floating promise;
prefix the expression with void to mark it intentionally fire-and-forget (i.e.,
change the call site that uses toast.promise to use void toast.promise(...)).
Locate the call that passes patchTierMutation.mutateAsync({ teamId:
props.teamId, request: { team_user_id: member.user_id, new_tier: newTier } })
into toast.promise and add the void prefix so lint/unchecked-rejection warnings
are suppressed while preserving existing onError handling.
In `@js/app/packages/queries/team/members.ts`:
- Around line 70-80: The cached userInfo check uses the wrong field and type;
change the getQueryData call to use the canonical UserInfoData type (import
UserInfoData from `@queries/auth`) and compare userInfo.id to request.team_user_id
(not userId), then keep the existing invalidateQueries calls for
authKeys.userInfo.queryKey and authKeys.userQuota.queryKey so they fire when the
current user’s tier changes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 39d2f1a0-4fd3-4222-aac2-d5dc3b7b9a60
📒 Files selected for processing (2)
js/app/packages/app/component/settings/Team.tsxjs/app/packages/queries/team/members.ts
This PR updates the tier change to display toasts using
toast.promiseand apply an optimistic update because the backend request takes a while to complete. Also, this fixes an issue where changing your own tier wasn't reflecting in the subscription tab of settings