Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #11535 crud的source切换后分页失效问题修复 #11579

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/amis/src/renderers/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,10 @@ 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 (
Expand All @@ -711,16 +715,12 @@ export default class Table extends React.Component<TableProps, object> {
!isEqual(
getPropValue(prevProps, (props: TableProps) => props.items),
value
))
) ||
resolved !== prev)
) {
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
Loading