Skip to content

Commit

Permalink
fix: #11535 crud的source切换后分页失效问题修复
Browse files Browse the repository at this point in the history
  • Loading branch information
chenwenhao committed Feb 12, 2025
1 parent 85d4c94 commit d3acfe6
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions packages/amis/src/renderers/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -703,24 +703,25 @@ export default class Table extends React.Component<TableProps, object> {
const value = getPropValue(props, (props: TableProps) => props.items);
let rows: Array<object> = [];
let updateRows = false;
const resolved = resolveVariableAndFilter(source, props.data, '| raw');
const prev = prevProps
? resolveVariableAndFilter(source, prevProps.data, '| raw')
: null;

// 要严格比较前后的value值,否则某些情况下会导致循环update无限渲染
if (
Array.isArray(value) &&
(!prevProps ||
if (Array.isArray(value)) {
if (
!prevProps ||
!isEqual(
getPropValue(prevProps, (props: TableProps) => props.items),
value
) ||
resolved !== prev)
) {
updateRows = true;
rows = value;
)
) {
updateRows = true;
rows = value;
}
} else if (typeof source === 'string') {
const resolved = resolveVariableAndFilter(source, props.data, '| raw');
const prev = prevProps
? resolveVariableAndFilter(source, prevProps.data, '| raw')
: null;

if (prev === resolved) {
updateRows = false;
} else {
Expand Down

0 comments on commit d3acfe6

Please sign in to comment.