Repository navigation
fix(core): update editor controls after filling in from another locale - #8064
Conversation
"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
✅ Deploy Preview for decap-cms ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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>
|
Thanks for the fix, @sap1110. The remount approach matches how I pushed one commit that removes No action needed on your side. This is good to merge once CI is green. |
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
fieldRevisionsremount used for externally changed fields, without the highlight.Test plan
EditorControlPane.spec.js: renders the pane with a control that only reads its value on mount, fills indefromen, and checks the new value is shown. It fails without the change and passes with it.pnpm run test:unit,pnpm run lint-quietandpnpm run type-checkpass.Checklist