Skip to content

fix(core): update editor controls after filling in from another locale - #8064

Merged
martinjagodic merged 3 commits into
decaporg:mainfrom
sap1110:7507-fill-in-locale-rerender
Nov 18, 2026
Merged

martinjagodic merged 3 commits into
decaporg:mainfrom
sap1110:7507-fill-in-locale-rerender

Conversation

@sap1110

@sap1110 sap1110 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #7507

"Fill in from another locale" writes the copied values to the entry draft (the preview updates), but the editor controls keep their React key, so widgets that only read their value on mount, such as markdown, keep showing the old content until the locale is switched back and forth.

This bumps a per-field counter for each copied field and includes it in the control's key, so only the copied controls remount and show the new value. It mirrors the existing fieldRevisions remount used for externally changed fields, without the highlight.

Test plan

  • Added EditorControlPane.spec.js: renders the pane with a control that only reads its value on mount, fills in de from en, and checks the new value is shown. It fails without the change and passes with it.
  • pnpm run test:unit, pnpm run lint-quiet and pnpm run type-check pass.

Checklist

"Fill in from another locale" wrote the copied values to the draft, but
widgets that keep their value in local state (such as markdown) kept
showing the old content until the locale was switched. Remount the
copied fields' controls so they read the new value.

Fixes decaporg#7507
@sap1110
sap1110 requested a review from a team as a code owner November 4, 2026 21:26
@netlify

netlify Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for decap-cms ready!

Name Link
🔨 Latest commit 23ba8ee
🔍 Latest deploy log https://app.netlify.com/projects/decap-cms/deploys/6afd8b89760bd53109420199
😎 Deploy Preview https://deploy-preview-8064--decap-cms.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

martinjagodic
martinjagodic previously approved these changes Nov 17, 2026
The fix only remounts stale widgets; the copied values were already
written to the draft correctly. We keep unit tests for business-critical
paths (data, auth, permissions), and this spec mocks EditorControl and
the collections reducer, so it mostly asserts a React key change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@martinjagodic

Copy link
Copy Markdown
Member

Thanks for the fix, @sap1110. The remount approach matches how fieldRevisions already handles externally changed fields, and it works in the side-by-side i18n view too.

I pushed one commit that removes EditorControlPane.spec.js. The test is fine; we're just trying to keep the unit suite focused on business-critical paths (data integrity, auth, permissions). Here the copied values were already written to the draft correctly, and the fix only makes stale widgets show them. The spec also mocks out EditorControl and the collections reducer, so what it mostly checks is that a React key changes. That doesn't buy much protection for what it costs to maintain.

No action needed on your side. This is good to merge once CI is green.

@martinjagodic
martinjagodic merged commit a80a56c into decaporg:main Nov 18, 2026
14 checks passed
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.

i18n: "Fill in from another locale" appears to do nothing

2 participants