Skip to content

fix(core): preserve full entries returned by preSave handlers - #7989

Open
sridharkalaibala wants to merge 1 commit into
decaporg:mainfrom
sridharkalaibala:7966-fix-presave-entry-return
Open

fix(core): preserve full entries returned by preSave handlers#7989
sridharkalaibala wants to merge 1 commit into
decaporg:mainfrom
sridharkalaibala:7966-fix-presave-entry-return

Conversation

@sridharkalaibala

Copy link
Copy Markdown

Summary

Fixes #7966. A preSave handler returning entry.setIn(['i18n', locale, 'data', 'title'], value) is currently wrapped inside the entry's data. This causes internal entry metadata to be saved as default-locale content and leaves the translation unchanged.

Preserve complete entry returns directly, while continuing to wrap field-data returns. Recognize the full entry by its Immutable Map shape and the data, collection, slug, and path keys supplied by createEntry; checking only data would misclassify a legitimate content field with that name. The event still returns the complete entry, preserving the file-collection fix from #7667.

Test plan

  • Four new tests cover full-entry returns, mixed full-entry/data-only handler chains (including an undefined return), a content field named data, and passing a translated entry through the actual multiple-folder i18n file generator. The output assertions verify intact English content and updated Portuguese content in separate files.
  • The first two regression tests failed against the original registry implementation before the fix. Focused registry, backend, and i18n suites: 142 tests pass, including the existing file-collection slug-preservation test.
  • Full pnpm test passes: lint (JavaScript, CSS, formatting), TypeScript, 4 Cypress-runner tests, and 1,388 Jest tests across 112 suites with 138 snapshots. The existing 1,304 skipped tests / 2 skipped suites remain skipped.
  • git diff --check passes. No live GitHub/GitLab save or browser E2E was run. No dependency or lockfile changes.
  • AI assistance: developed and validated with OpenAI Codex.

Checklist

@sridharkalaibala
sridharkalaibala requested a review from a team as a code owner September 11, 2026 19:41
@netlify

netlify Bot commented Sep 11, 2026

Copy link
Copy Markdown

Deploy Preview for decap-cms ready!

Name Link
🔨 Latest commit 85cae94
🔍 Latest deploy log https://app.netlify.com/projects/decap-cms/deploys/6aa459850bea8500073149bb
😎 Deploy Preview https://deploy-preview-7989--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.

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.

preSave handler can't write entry.i18n[locale].data anymore for multiple_folders i18n collections -- regression from #7667

1 participant