fix(document): do not strip editor.hidden fields from document tree#447
Open
surohak wants to merge 2 commits into
Open
fix(document): do not strip editor.hidden fields from document tree#447surohak wants to merge 2 commits into
surohak wants to merge 2 commits into
Conversation
sanitizeDocumentTree deletes properties marked with `editor.hidden` in the collection schema. The intent is that these fields are auto-generated by modules/hooks and shouldn't appear in the editor. However, stripping them from the document entirely breaks runtime usage: components and layouts that consume these fields (e.g. computed SEO fields, navigation flags, custom meta) receive undefined values. The `editor.hidden` annotation should only control visibility in the Studio editor UI, not strip data from the document at the data layer. The editor already respects this flag when rendering form fields — the deletion in sanitizeDocumentTree is redundant for editor hiding and harmful for runtime consumers. Removing this block preserves all document data while the editor UI continues to hide these fields from the editing interface.
Contributor
|
Someone is attempting to deploy a commit to the Nuxt Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
sanitizeDocumentTreedeletes all properties marked witheditor.hiddenin the collection schema from the document object. The original intent was that these fields are auto-generated by modules/hooks and shouldn't appear in the editor.However, stripping them from the document entirely breaks runtime usage: components and layouts that consume these fields (e.g. computed SEO fields, navigation flags, custom metadata) receive
undefinedvalues in preview mode.Problem
The
editor.hiddenannotation should only control visibility in the Studio editor UI, not strip data from the document at the data layer. The editor already respects this flag when rendering form fields for editing — the deletion insanitizeDocumentTreeis redundant for editor hiding and harmful for:Fix
Remove the block in
sanitizeDocumentTreethat iterates hidden keys and deletes them from the document. This preserves all document data while the editor UI continues to hide these fields from the editing interface as intended.Changes
src/module/src/runtime/utils/document/tree.ts: Remove theeditor.hiddenkey deletion block