This repository was archived by the owner on Sep 30, 2024. It is now read-only.
feat(plg): Tweak invite co-workers flow#63374
Merged
Merged
Conversation
Comment on lines
+91
to
+104
| const getTeamInviteButton = useCallback(() => { | ||
| const isSoloUser = subscriptionSummaryQueryResult?.data?.teamMaxMembers === 1 | ||
| const hasFreeSeats = subscriptionSummaryQueryResult?.data ? subscriptionSummaryQueryResult.data.teamMaxMembers > subscriptionSummaryQueryResult.data.teamCurrentMembers : false | ||
| const targetUrl= hasFreeSeats ? '/cody/team/manage' : '/cody/manage/subscription/new?addSeats=1' | ||
| const label = (isSoloUser || hasFreeSeats) ? 'Invite co-workers' : 'Add seats' | ||
| return <Button | ||
| as={Link} | ||
| to={targetUrl} | ||
| variant="success" | ||
| className="text-nowrap" | ||
| > | ||
| <Icon aria-hidden={true} svgPath={mdiPlusThick} /> {label} | ||
| </Button> | ||
| }, [subscriptionSummaryQueryResult?.data]) |
Contributor
There was a problem hiding this comment.
We may have a wrong button label for a while:
- when
subscriptionSummaryQueryResult.isLoadingisSoloUserandhasFreeSeatswill be false, and 'Add seats' label will be shown subscriptionSummaryQueryResultgets to error or success state in a while and one of the mentioned variables may havetruevalue and label will be 'Invite co-workers'.
I suggest we return null until we get subscriptionSummaryQueryResult fetched.
I also think we don't need useCallback here. It doesn't seem to add any performance gains: the <Button component will be recreated anyway.
Contributor
Author
There was a problem hiding this comment.
Makes sense. Did both changes in https://github.com/sourcegraph/sourcegraph/pull/63374/commits/77969a77322bac1a0de74dd1019a01dd932a58c9
taras-yemets
approved these changes
Jun 20, 2024
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The "Invite co-workers" flow was not up to spec.
This PR fixes it to match this spec:
Test plan
Here is a 1-min Loom where I went through all cases.