Skip to content

Commit

Permalink
Merge pull request #6 from wwsheng009/patch20240221
Browse files Browse the repository at this point in the history
fix the undefined error for the chart config,and avoid the undefined error for the empty column config in filter node
  • Loading branch information
trheyi authored Feb 21, 2024
2 parents 32858c1 + 4a1e126 commit 64c6ef7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/xgen/components/chart/NumberChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const Index = (props: IProps) => {
const global = useGlobal()
const ref = useRef<HTMLDivElement>(null)

const current = props.data[props.data.length - 1]
const current = props.data[props.data.length - 1] || { value : 0}
const is_dark = global.theme === 'dark'
const is_line = props.type === 'line'

Expand Down
12 changes: 6 additions & 6 deletions packages/xgen/services/utils/column.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ export class ColumnUtils {
}

reduce(columns: Array<Common.BaseColumn>, fields: Common.Fields) {
return columns.reduce((total: Array<Common.Column>, item) => {
return (columns || []).reduce((total: Array<Common.Column>, item) => {
total.push(this.handleTableColumn(item, fields))

return total
}, [])
}

reduceAny<I, O, F>(columns: Array<I & Item>, fields: F & Fields) {
return columns.reduce((total: Array<O>, item) => {
return (columns || []).reduce((total: Array<O>, item) => {
total.push(this.handleAnyColumn(item, fields))

return total
Expand All @@ -69,11 +69,11 @@ export class ColumnUtils {
return total
}

return sections.reduce((total: Array<FormType.SectionResult>, item) => {
return (sections || []).reduce((total: Array<FormType.SectionResult>, item) => {
total.push({
title: item.title,
desc: item.desc,
columns: item.columns.reduce(getColumns, [])
columns: (item.columns || []).reduce(getColumns, [])
})

return total
Expand All @@ -94,11 +94,11 @@ export class ColumnUtils {
return total
}

return columns.reduce((total: Array<Dashboard.TargetColumn>, item) => {
return (columns || []).reduce((total: Array<Dashboard.TargetColumn>, item) => {
if ('rows' in item) {
total.push({
width: item.width,
rows: item.rows.reduce(getColumns, [])
rows: (item.rows || []).reduce(getColumns, [])
})
} else {
total.push(this.handleAnyColumn(item, fields))
Expand Down

0 comments on commit 64c6ef7

Please sign in to comment.