This commit is contained in:
liaoxuezhi 2021-07-01 23:28:43 +08:00 committed by GitHub
parent 638e42d25f
commit 5fbe3b331c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 6 deletions

View File

@ -257,10 +257,14 @@ export default class Cards extends React.Component<GridProps, object> {
const source = props.source;
const value = props.value || props.items;
let items: Array<object> = [];
let updateItems = true;
let updateItems = false;
if (Array.isArray(value)) {
if (
Array.isArray(value) &&
(!prevProps || (prevProps.value || prevProps.items) !== value)
) {
items = value;
updateItems = true;
} else if (typeof source === 'string') {
const resolved = resolveVariableAndFilter(source, props.data, '| raw');
const prev = prevProps
@ -271,6 +275,7 @@ export default class Cards extends React.Component<GridProps, object> {
updateItems = false;
} else if (Array.isArray(resolved)) {
items = resolved;
updateItems = true;
}
}

View File

@ -327,10 +327,14 @@ export default class List extends React.Component<ListProps, object> {
const source = props.source;
const value = props.value || props.items;
let items: Array<object> = [];
let updateItems = true;
let updateItems = false;
if (Array.isArray(value)) {
if (
Array.isArray(value) &&
(!prevProps || (prevProps.value || prevProps.items) !== value)
) {
items = value;
updateItems = true;
} else if (typeof source === 'string') {
const resolved = resolveVariableAndFilter(source, props.data, '| raw');
const prev = prevProps
@ -341,6 +345,7 @@ export default class List extends React.Component<ListProps, object> {
updateItems = false;
} else if (Array.isArray(resolved)) {
items = resolved;
updateItems = true;
}
}

View File

@ -479,9 +479,13 @@ export default class Table extends React.Component<TableProps, object> {
const source = props.source;
const value = props.value || props.items;
let rows: Array<object> = [];
let updateRows = true;
let updateRows = false;
if (Array.isArray(value)) {
if (
Array.isArray(value) &&
(!prevProps || (prevProps.value || prevProps.items) !== value)
) {
updateRows = true;
rows = value;
} else if (typeof source === 'string') {
const resolved = resolveVariableAndFilter(source, props.data, '| raw');
@ -492,6 +496,7 @@ export default class Table extends React.Component<TableProps, object> {
if (prev && prev === resolved) {
updateRows = false;
} else if (Array.isArray(resolved)) {
updateRows = true;
rows = resolved;
}
}