Team selector ux fix - #31
Open
a-effort wants to merge 1 commit into
Open
Conversation
Team visibility was driven entirely by the sidebar switcher, which starts on "All teams" every session. A caller with one team was told to go pick the only team they have, and the form flagged the field red the moment they chose "Team" — before they had done anything wrong. Resolve the team in the form instead: an explicit choice, else the sidebar's active team, else the caller's personal (or only) team. Callers in more than one team now pick inline via a new TeamSelect rather than being sent to the sidebar, and the requirement is raised on submit rather than on entering team visibility. The sidebar switcher stays authoritative for an open form (#5077) until the caller picks a team in the selector. Signed-off-by: Anna Effort <anna.effort@ibm.com>
a-effort
force-pushed
the
team-selection-single-team
branch
from
August 14, 2026 20:15
d530df8 to
7d79a6b
Compare
a-effort
requested review from
gcgoncalves,
marekdano and
vishu-bh
and removed request for
gcgoncalves
August 14, 2026 20:16
a-effort
marked this pull request as ready for review
August 14, 2026 20:16
gcgoncalves
approved these changes
Aug 14, 2026
gcgoncalves
left a comment
Contributor
There was a problem hiding this comment.
Nice validation addition. 👏
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.
UX issue
If an user has only one team, they see an error message in a form they are filling out and are required to leave their workflow to find the team switcher and make a selection, even if they are only part of 1 team. e.g.
Changes
The sidebar switcher stays authoritative for an open form (#5077) until the caller picks a team in the selector.
Root cause
Team visibility was driven entirely by the sidebar switcher, and
selectedTeamIdstarts asnull("All teams") every session (AuthContext.tsx, also reset on login). The forms never looked at the actual team list, so they could not tell "no team chosen" apart from "only one team exists". A second, independent defect:usePromptFormre-validated in an effect whenever visibility wasteam, so the field turned red the moment the user picked "Team"... before they had done anything wrong.What was added
src/hooks/useTeams.ts:useTeams()plusresolveTeamId(teams, selectedTeamId, explicitTeamId). Resolution order: explicit choice → sidebar's active team → the caller's personal team → first team. The last two steps are what keep a single-team caller from ever being asked, and give multi-team callers a sane default instead of an empty required field behind a disabled submit button.src/components/common/TeamSelect.tsx: renders nothing below two teams; renders a labeled select above. It still renders an error with no selector, so a failed/teamsload explains an inert submit button rather than failing silently.Both are shared by all three forms, which previously each had their own copy of the sidebar-mirroring logic: prompts (
usePromptForm+PromptForm), tools (ToolAdvancedSettings), servers (mcp-servers/AdvancedSettings).Other changes
visibilitytoteamIdin the prompt schema, so the message lands on the selector rather than the visibility dropdown. APIteam_idfield errors now map toteamIdtoo (previouslyvisibility).prompts.add.visibility.team.selectedHintand...selectFromSidebarHint; addedcommon.team.label,common.team.placeholder,common.required. The hardcoded English equivalents in the tool and server forms are gone as well.-
teamErrorprop added toToolAdvancedSettingsandmcp-servers/AdvancedSettings—errors.teamIdexisted in both form hooks but was never rendered anywhere.-
usePromptFormnow owns team state (teamId+setTeamId) instead of deriving it read-only from the sidebar.Testing
npm testgreen: 161 files, 2857 passed / 1 skipped. Typecheck and lint clean.New:
useTeams.test.ts,TeamSelect.test.tsx. Updated the team-visibility cases inusePromptForm.test.ts,PromptForm.test.tsx,MCPServerForm.test.tsx,AdvancedSettings.test.tsx,ToolAdvancedSettings.test.tsxThe old ones asserted the sidebar hint text and the pre-submit error, both of which are the behavior being removed.
Notes
teamvisibility, the sidebar/default wins until the user touches the selector, so editing a team-scoped server can retarget it. This is pre-existing (the old code mirroredselectedTeamIdunconditionally) and not introduced here. We should consider changing this as a follow up.MCPServerForm.test.tsx > team visibility > shows the selector for several teamsasserts only that the selector renders, not that it defaults to the personal team. The state does propagate correctly (verified by instrumenting the effect); that MSW-driven test's DOM would not settle on it. The defaulting behavior is asserted inAdvancedSettings.test.tsxandPromptForm.test.tsx.ToolAuth.test.tsx > shows team scope hint.... The hint no longer exists, and that file has no/teamsmock, so any replacement would have passed for the wrong reason. Equivalent coverage lives inToolAdvancedSettings.test.tsx.