Wizard: prevent duplicate languages in Locale step (HMS-10599)#4527
Open
mgold1234 wants to merge 1 commit into
Open
Wizard: prevent duplicate languages in Locale step (HMS-10599)#4527mgold1234 wants to merge 1 commit into
mgold1234 wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #4527 +/- ##
==========================================
+ Coverage 75.62% 75.64% +0.01%
==========================================
Files 250 249 -1
Lines 7159 7152 -7
Branches 2655 2655
==========================================
- Hits 5414 5410 -4
+ Misses 1503 1500 -3
Partials 242 242
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
8cd084e to
2a1c815
Compare
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Using
indexas part of the React key inLanguagesDropDowncan still cause subtle rendering bugs when items are reordered or removed; consider using a stable key such as${lang}-${occurrenceIndex}whereoccurrenceIndexis derived from counting occurrences of the same language up to that point. - In
replaceLanguage, the duplicate guard logic is a bit dense; extracting theisDuplicatecheck into a small helper function (with a short comment explaining theoldLanguageexception) would make the intent clearer and reduce chances of future regressions when this logic is modified.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Using `index` as part of the React key in `LanguagesDropDown` can still cause subtle rendering bugs when items are reordered or removed; consider using a stable key such as `${lang}-${occurrenceIndex}` where `occurrenceIndex` is derived from counting occurrences of the same language up to that point.
- In `replaceLanguage`, the duplicate guard logic is a bit dense; extracting the `isDuplicate` check into a small helper function (with a short comment explaining the `oldLanguage` exception) would make the intent clearer and reduce chances of future regressions when this logic is modified.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
3efaeac to
671a7b0
Compare
kingsleyzissou
previously approved these changes
Jun 17, 2026
kingsleyzissou
left a comment
Collaborator
There was a problem hiding this comment.
Looks good. I added some nitpicks inline, but we could do those in a follow up.
671a7b0 to
8e8e02c
Compare
`replaceLanguage` did not guard against duplicates, and `LanguageRow`
used `key={lang}` which caused React warnings when duplicates arrived
from an imported blueprint.
- Add duplicate guard to `replaceLanguage`
- Fix list key to handle duplicate entries
- Add tests for duplicate language validation
To reproduce: create a blueprint via API with
`languages: ["en_US.UTF-8", "en_US.UTF-8"]` and open it in the wizard.
8e8e02c to
4216b54
Compare
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.
replaceLanguagedid not guard against duplicates, andLanguageRowused
key={lang}which caused React warnings when duplicates arrivedfrom an imported blueprint.
replaceLanguageWhy is this needed?
The duplicate language validation and error message were already
implemented in a previous commit, but had no test coverage.
Additionally,
replaceLanguagedid not prevent creating duplicatesat the reducer level, and React would log warnings about duplicate
keys when a blueprint with duplicate languages was loaded from the API.
These changes harden the existing validation by preventing duplicates
at the source and ensuring the rendering handles them gracefully.
To reproduce
Create a blueprint via API with duplicate languages:
Then open the blueprint in the wizard — the Locale step shows
"Duplicated languages: en_US.UTF-8" and blocks the Next button.
JIRA: HMS-10599