Skip to content

Commit

Permalink
fix(antd/next): fix array string field addition logic (#2998)
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Mar 30, 2022
1 parent 18b91f8 commit 888dc47
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions packages/antd/src/array-base/index.tsx
Expand Up @@ -85,13 +85,13 @@ const useRecord = (record?: number) => {

const getSchemaDefaultValue = (schema: Schema) => {
if (schema?.type === 'array') return []
if (schema?.type === 'boolean') return true
if (schema?.type === 'date') return ''
if (schema?.type === 'datetime') return ''
if (schema?.type === 'number') return 0
if (schema?.type === 'object') return {}
if (schema?.type === 'string') return ''
return null
if (schema?.type === 'void') {
for (let key in schema.properties) {
const value = getSchemaDefaultValue(schema.properties[key])
if (isValid(value)) return value
}
}
}

const getDefaultValue = (defaultValue: any, schema: Schema) => {
Expand Down
12 changes: 6 additions & 6 deletions packages/next/src/array-base/index.tsx
Expand Up @@ -85,13 +85,13 @@ const useRecord = (record?: number) => {

const getSchemaDefaultValue = (schema: Schema) => {
if (schema?.type === 'array') return []
if (schema?.type === 'boolean') return true
if (schema?.type === 'date') return ''
if (schema?.type === 'datetime') return ''
if (schema?.type === 'number') return 0
if (schema?.type === 'object') return {}
if (schema?.type === 'string') return ''
return null
if (schema?.type === 'void') {
for (let key in schema.properties) {
const value = getSchemaDefaultValue(schema.properties[key])
if (isValid(value)) return value
}
}
}

const getDefaultValue = (defaultValue: any, schema: Schema) => {
Expand Down

0 comments on commit 888dc47

Please sign in to comment.