fix(custom-fields) : pass machineContextOnly through structure serialize/hydrate

- componentStructure: include machineContextOnly in save payload value object
- componentStructureHydrate: read machineContextOnly in hydrate and mapComponentCustomFields
- pieceProductStructure: include machineContextOnly in sanitize and hydrate

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-03 13:13:36 +02:00
parent a88e4a68fb
commit 7da78b3b3e
3 changed files with 12 additions and 1 deletions

View File

@@ -78,10 +78,18 @@ export const hydrateCustomFields = (fields: any[]): any[] => {
const customFieldId = typeof field?.customFieldId === 'string' ? field.customFieldId : undefined
const orderIndex = typeof field?.orderIndex === 'number' ? field.orderIndex : index
const machineContextOnly =
typeof field?.machineContextOnly === 'boolean'
? field.machineContextOnly
: typeof valueObject?.machineContextOnly === 'boolean'
? valueObject.machineContextOnly
: false
return {
name,
type,
required,
machineContextOnly,
options,
optionsText,
defaultValue,
@@ -153,6 +161,7 @@ export const mapComponentCustomFields = (fields: any[]) => {
name: typeof field?.name === 'string' ? field.name : '',
type: field?.type ?? 'text',
required: !!field?.required,
machineContextOnly: !!field?.machineContextOnly,
options: Array.isArray(field?.options) ? field.options : [],
optionsText: typeof field?.optionsText === 'string' ? field.optionsText : '',
defaultValue,