Skip to content

Commit

Permalink
fix(array-table): fix form not update when pagination changed
Browse files Browse the repository at this point in the history
  • Loading branch information
frehaiku committed Nov 22, 2022
1 parent 37687a5 commit c377663
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/components/src/array-table/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const useArrayTableSources = (
}

const useArrayTableColumns = (
dataSource: any[],
sources: ObservableColumnSource[]
): ColumnProps[] => {
return sources.reduce((buf, { name, columnProps, schema, display }, key) => {
Expand All @@ -111,7 +112,9 @@ const useArrayTableColumns = (
...columnProps,
key,
dataIndex: name,
customRender: ({ record, index }) => {
customRender: ({ record }) => {
const index = dataSource.indexOf(record)

const children = h(
ArrayBase.Item,
{
Expand Down Expand Up @@ -309,7 +312,7 @@ const ArrayTableInner = observer(
const field = fieldRef.value
const dataSource = Array.isArray(field.value) ? field.value.slice() : []
const sources = useArrayTableSources(fieldRef, schemaRef)
const columns = useArrayTableColumns(sources)
const columns = useArrayTableColumns(dataSource, sources)
const pagination = isBool(props.pagination) ? {} : props.pagination

const renderStateManager = () =>
Expand Down

0 comments on commit c377663

Please sign in to comment.