Gayatri - π₯ Invalid Team Code error when selecting a suggested QST team code β¦ - #5479
Merged
Merged
Conversation
β¦with trailing/leading whitespace
β Deploy Preview for highestgoodnetwork-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
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.



Description
Fixes an urgent bug in the Quick Setup Title (QST) "Edit Title" modal where selecting a valid, actively-suggested team code and clicking Confirm incorrectly showed "Invalid team code. Please provide a valid team code."
Root Cause
QSTTeamCodesin QuickSetupModal.jsx is built from Redux state (stateTeamCodes). If any team code in that state has leading/trailing whitespace (common with admin-entered or spreadsheet-sourced data), the dropdown's fuzzy search still matched and displayed it correctly as a suggestion. However, the code was stored with its whitespace intact, while the confirm-time validation trimmed only the selected value before comparing it against the untrimmed array β causing an exact-match failure even though it was the exact code that had just been suggested.Fix
Trim both
valueandlabelwhen buildingQSTTeamCodes, for both the string and object code formats, so whitespace never causes a mismatch between what's suggested and what's validated.How to test
npm installandyarn start:skip-testsTesting
Added a new unit test simulating a team code with trailing whitespace, verifying the full select β confirm flow succeeds and the submitted payload contains the trimmed value. All existing tests (2198 total) and lint pass.