CMG-1057, CMG-1058 | Language Mapper and Locale Migration Fixes#1108
CMG-1057, CMG-1058 | Language Mapper and Locale Migration Fixes#1108chetan-contentstack wants to merge 4 commits into
Conversation
CMG-1057: fix already-mapped locales appearing in dropdowns on restart, Add Language button stuck disabled after one addition, and rows locking prematurely before user advances past step 2. CMG-1058: route new-locale entries through localize path instead of creating duplicate entries; fix save button visibility and sticky footer in entry mapper; tighten step-1→step-3 skip guard to require all source locales mapped before bypassing step 2.
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
There was a problem hiding this comment.
Pull request overview
This PR tightens the delta-restart locale-mapping flow in the UI (preventing users from bypassing Step 2 when mappings are incomplete) and fixes backend delta behavior so newly-added locales localize existing entries instead of importing duplicates.
Changes:
- UI: Strengthens Step 1 → Step 3 skip logic to require a complete source-locale mapping and improves language-mapper restart behavior (filtering/locking/editability).
- UI: Makes Entry Mapper’s Save/footer reliably visible and adjusts Save disabling to reflect actual migration execution state.
- API: Routes entries for newly-added delta locales through the localize/update path (when CS UID exists) to prevent duplicate entry creation.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/pages/Migration/index.tsx | Tightens Step skip guard to avoid bypassing locale mapping on non-restart flows. |
| ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx | Fixes delta-restart mapper option filtering, row locking/editability, and rehydration edge cases. |
| ui/src/components/ContentMapper/index.scss | Makes the Entry Mapper footer sticky so Save remains reachable. |
| ui/src/components/ContentMapper/entryMapper.tsx | Shows footer based on table data presence and disables Save only while migration is actively running. |
| api/src/utils/entry-update.utils.ts | Ensures new-locale delta entries with existing CS UIDs are localized/updated instead of re-created. |
| .gitignore | Adds additional ignored output directories. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- allSourceLocalesMapped: verify each source locale exists in mapped values instead of comparing raw counts (filters out placeholder keys like UNMAPPED_LOCALE_KEY and prevents duplicates from inflating count) - LoadLanguageMapper: remove dead savedKey/savedValue/isRowSaved vars - LoadLanguageMapper: fix recentMsterLocale typo -> recentMasterLocale
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
🔗 Jira Ticket
CMG-1057 · CMG-1058
📋 PR Type
📝 Description
What changed?
CMG-1057 — Language mapper (Step 2) fixes for delta restart:
CMG-1058 — Delta migration correctness and UI fixes:
Why?
On a delta restart with extra locales added, the language mapper was showing already-consumed locales in dropdowns and blocking the user from adding more than one new language. On migration, new-locale entries were being imported as fresh entries (new UIDs) instead of being added as localizations to the entries created in the first iteration, breaking the localization relationship entirely.
🧩 Affected Areas
api— Node.js backendui— React frontendupload-api— Upload API serverdocker/docker-compose🧪 How to Test
CMG-1057:
CMG-1058:
Expected result: No duplicate entries created for new locales; existing entries gain locale variants. Language mapper dropdowns filter correctly and rows remain editable until saved.
📸 Screenshots / Recordings
🔗 Related PRs / Dependencies
✅ Author Checklist
feature/,bugfix/, orhotfix/+ 5–30 lowercase chars.env/example.envupdated if new environment variables were addednpm test)README.md/ docs updated if behaviour changed👀 Reviewer Notes
api/src/utils/entry-update.utils.ts— theremoveEntriesFromDatabasefunction previously skipped new-locale directories entirely (continue), leaving their entries in the import data for the CLI to create as fresh entries. It now falls through and routes any entry with a known Contentstack UID into the localize path (entriesToUpdate), removing it from import data to prevent duplication.LoadLanguageMapper.tsx. The key invariant:locale.valueis only set on rows rebuilt from a prior iteration's saved mapping; newly-added rows always havevalue = '', soisDisabled && !!locale.valuecorrectly locks only rebuilt rows.