fix[smartling]: ENG-12342 fix 'Clear translation metadata' button not working#4544
fix[smartling]: ENG-12342 fix 'Clear translation metadata' button not working#4544Manish-Builder-io wants to merge 1 commit intomainfrom
Conversation
`content.meta` is a MobX observable Map; calling `fastClone` on it
(JSON.parse/JSON.stringify) serialises it as `{}`, so the subsequent
`delete` calls were no-ops and `updateLatestDraft` was called with an
empty meta object instead of the correctly-stripped one.
Replace `fastClone(content.meta)` with `{ ...content.meta?.toJS() }`
to match the identical pattern already used in the backend's
`cleanupOrphanedTranslationMetadata` helper in `smartling.ts`.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
View your CI Pipeline Execution ↗ for commit e967d02
☁️ Nx Cloud last updated this comment at |
1 similar comment
|
View your CI Pipeline Execution ↗ for commit e967d02
☁️ Nx Cloud last updated this comment at |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx test @snippet/react |
❌ Failed | 4m 12s | View ↗ |
nx test @e2e/nextjs-sdk-next-app |
✅ Succeeded | 7m 45s | View ↗ |
nx test @e2e/angular-17 |
✅ Succeeded | 6m 39s | View ↗ |
nx test @e2e/qwik-city |
✅ Succeeded | 7m 10s | View ↗ |
nx test @e2e/nuxt |
✅ Succeeded | 6m 3s | View ↗ |
nx test @e2e/gen1-next15-app |
✅ Succeeded | 5m 26s | View ↗ |
nx test @e2e/angular-17-ssr |
✅ Succeeded | 6m 4s | View ↗ |
nx test @e2e/angular-19-ssr |
✅ Succeeded | 5m 51s | View ↗ |
Additional runs (38) |
✅ Succeeded | ... | View ↗ |
☁️ Nx Cloud last updated this comment at 2026-04-28 13:41:35 UTC
anaghav2023
left a comment
There was a problem hiding this comment.
@Manish-Builder-io changes look good.
Did you test it?

Problem
The Clear translation metadata content action in the Smartling plugin was silently broken. Clicking the button and confirming the dialog appeared to succeed (snackbar showed "Translation metadata cleared."), but the translation fields (
translationStatus,translationJobId, etc.) were never actually removed from the content.Root Cause
content.metais a MobX observable Map. The button'sonClickhandler cloned it usingfastClone:JSON.stringifyon a MobX observable Map serialises it as{}(an empty plain object) — Map entries are not picked up by the default JSON serialiser. As a result:updatedMetawas always{}delete updatedMeta.translationStatus(etc.) calls were no-ops on a field that didn't existupdateLatestDraftwas called withmeta: {}, either leaving the translation fields untouched (if the API merges) or wiping all metadata (if the API replaces)Fix
Replace
fastClone(content.meta)with{ ...content.meta?.toJS() }..toJS()is the correct MobX API for converting an observable Map to a plain JS object. The spread then creates a regular mutable copy, and thedeleteoperations work as intended.This is exactly the same pattern already used in the backend's
cleanupOrphanedTranslationMetadatahelper (smartling.ts:465), confirming it's the correct approach.Test Plan
translationStatus=completedortranslationJobIdset, not inpending/local)translationStatus,translationJobId,translationBy,translationRevision,translationRevisionLatest,translationBatch,translationRequested) are gone from the meta🤖 Generated with Claude Code
Note
Low Risk
Low risk: a small, localized change to how
content.metais converted to a plain object before deleting translation fields; no auth or data model changes beyond fixing the metadata update payload.Overview
Fixes the Smartling “Clear translation metadata” content action to correctly remove translation fields by converting the MobX
content.metamap to a plain object viacontent.meta?.toJS()instead offastClone(JSON cloning).This ensures the subsequent
deleteoperations produce an updatedmetapayload that actually clearstranslationStatus,translationJobId, and related keys when callingupdateLatestDraft.Reviewed by Cursor Bugbot for commit e967d02. Bugbot is set up for automated code reviews on this repo. Configure here.