Skip to content

Gayatri - fix(quick-setup): trim canonical team codes before comparison (follow… - #5550

Open
sawantgayatri19 wants to merge 1 commit into
developmentfrom
fix/team-code-whitespace-comparison-followup
Open

sawantgayatri19 wants to merge 1 commit into
developmentfrom
fix/team-code-whitespace-comparison-followup

Conversation

@sawantgayatri19

Copy link
Copy Markdown

Description

Fixes # 5479 (still occurring 2 weeks after merge — Invalid Team Code error when selecting a suggested QST team code)

PR #5479 fixed whitespace trimming for suggested team codes, but only in QuickSetupModal.jsx's dropdown-options builder. AddNewTitleModal.jsx uses a completely separate QSTTeamCodes-based validation flow that PR never touched — explaining why the error persisted after that fix merged.

Root cause: both the live-validation effect and the existTeamCodes Set correctly trimmed the user's selected value before comparing, but compared it against code?.value from QSTTeamCodes without trimming that side too. A whitespace-padded canonical list entry can never match a correctly-trimmed selection via strict equality, even though they represent the same team code.

Related PRs (if any):

Follow-up to #5479.

Main changes explained:

  • Update AddNewTitleModal.jsx — trim code?.value in both the live-validation useEffect comparison and the existTeamCodes Set-building logic, so a whitespace-padded canonical entry and a trimmed user selection are correctly recognized as equal.

How to test:

  1. Check out this branch: fix/team-code-whitespace-comparison-followup
  2. npm install, run frontend + backend dev servers
  3. Go to a user profile, open Quick Setup → Add New Title
  4. Select a team code from the suggested dropdown that has leading/trailing whitespace in the underlying data (or manually verify against a QSTTeamCodes entry known to have this issue)
  5. Confirm no "Invalid Team Code" / "Team Code Not Exists" error appears, and the code is accepted

Note:

No existing unit tests cover AddNewTitleModal.jsx; happy to add coverage for this specific comparison logic if requested during review.

…-up to PR #5479)

PR #5479 fixed whitespace-trimming for suggested team codes in
QuickSetupModal.jsx's dropdown-options builder, but AddNewTitleModal.jsx
uses a separate QSTTeamCodes-based flow that was never touched by that
fix -- explaining why 'Invalid Team Code' errors persisted after that
PR merged.

Root cause: the live-validation effect and existTeamCodes Set both
trimmed the user's selected value before comparing, but compared it
against code?.value from QSTTeamCodes without also trimming that side.
If the canonical list itself contains whitespace-padded codes, a
correctly-trimmed selection can never match via strict equality.

Fixed both comparison sites to trim code?.value as well, so a
whitespace-padded canonical entry and a trimmed selection are
correctly recognized as equal.
@netlify

netlify Bot commented Sep 15, 2026

Copy link
Copy Markdown

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit d57d913
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/6aa8c7f7b2999d0009d66241
😎 Deploy Preview https://deploy-preview-5550--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants