fix(custom-fields) : preserve defaultValue and IDs in piece structure editor
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -86,6 +86,19 @@ const sanitizePieceCustomFields = (fields: any[]): PieceModelCustomField[] => {
|
||||
if (options) {
|
||||
result.options = options
|
||||
}
|
||||
const defaultValue =
|
||||
field?.defaultValue !== undefined && field?.defaultValue !== null && field?.defaultValue !== ''
|
||||
? String(field.defaultValue)
|
||||
: null
|
||||
if (defaultValue !== null) {
|
||||
result.defaultValue = defaultValue
|
||||
}
|
||||
if (typeof field?.id === 'string' && field.id) {
|
||||
result.id = field.id
|
||||
}
|
||||
if (typeof field?.customFieldId === 'string' && field.customFieldId) {
|
||||
result.customFieldId = field.customFieldId
|
||||
}
|
||||
const orderIndex = typeof field?.orderIndex === 'number' ? field.orderIndex : index
|
||||
result.orderIndex = orderIndex
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user