Skip to content

fix(teams): tier changes not giving proper feedback#2913

Merged
dev-rb merged 5 commits into
mainfrom
rahul/fix-teams-optimistic-updates
Apr 27, 2026
Merged

fix(teams): tier changes not giving proper feedback#2913
dev-rb merged 5 commits into
mainfrom
rahul/fix-teams-optimistic-updates

Conversation

@dev-rb
Copy link
Copy Markdown
Contributor

@dev-rb dev-rb commented Apr 27, 2026

This PR updates the tier change to display toasts using toast.promise and 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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

Warning

Rate limit exceeded

@dev-rb has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 40 minutes and 44 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b1a575ff-2808-4257-b061-d7388dba4aac

📥 Commits

Reviewing files that changed from the base of the PR and between 56c04c6 and ebc3e32.

📒 Files selected for processing (2)
  • js/app/packages/app/component/settings/Team.tsx
  • js/app/packages/queries/team/members.ts
📝 Walkthrough

Walkthrough

Team 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

Cohort / File(s) Summary
UI Component Tier Updates
js/app/packages/app/component/settings/Team.tsx
Switched from synchronous mutate to asynchronous mutateAsync for tier patch mutations, wrapped with toast.promise() to display loading, success, and failure messages to users.
Tier Mutation Query Logic
js/app/packages/queries/team/members.ts
Implemented optimistic updates with cache snapshots on onMutate, rollback on onError using saved context, and extended onSuccess to invalidate user info and quota queries when the updated member is the current user.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title follows conventional commits format with 'fix:' prefix and is 51 characters, well under the 72-character limit, accurately summarizing the main change.
Description check ✅ Passed The description is directly related to the changeset, explaining the toast.promise implementation, optimistic updates for tier changes, and the fix for subscription tab reflection.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0e0d05a and 56c04c6.

📒 Files selected for processing (2)
  • js/app/packages/app/component/settings/Team.tsx
  • js/app/packages/queries/team/members.ts

Comment thread js/app/packages/app/component/settings/Team.tsx Outdated
Comment thread js/app/packages/queries/team/members.ts Outdated
@dev-rb dev-rb merged commit 54d7ea6 into main Apr 27, 2026
23 checks passed
@dev-rb dev-rb deleted the rahul/fix-teams-optimistic-updates branch April 27, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant