fix: crud编辑器提示导致报错问题修复 (#8806)

Co-authored-by: wanglinfang <wanglinfang@baidu.com>
This commit is contained in:
wanglinfang2014 2023-11-21 10:40:15 +08:00 committed by GitHub
parent 81060bfda7
commit 4fd601a34e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3101 additions and 3100 deletions

File diff suppressed because it is too large Load Diff

View File

@ -704,10 +704,13 @@ export const CRUDStore = ServiceStore.named('CRUDStore')
const data = {
...self.pristine,
items: items.slice(
(self.page - 1) * self.perPage,
self.page * self.perPage
),
items:
items.length > self.perPage
? items.slice(
(self.page - 1) * self.perPage,
self.page * self.perPage
)
: items,
count: items.length,
total: items.length
};

View File

@ -686,7 +686,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
} else if (!props.api && isPureVariable(props.source)) {
const next = resolveVariableAndFilter(props.source, props.data, '| raw');
if (!this.lastData || !isEqual(this.lastData, next)) {
if (!this.lastData || this.lastData !== next) {
store.initFromScope(props.data, props.source, {
columns: store.columns ?? props.columns
});

View File

@ -21,7 +21,6 @@ import {findDOMNode} from 'react-dom';
import {evalExpression, filter} from 'amis-core';
import {isEffectiveApi, isApiOutdated} from 'amis-core';
import findIndex from 'lodash/findIndex';
import isEqual from 'lodash/isEqual';
import {Html, SpinnerExtraProps} from 'amis-ui';
import {
BaseSchema,
@ -395,7 +394,7 @@ export default class CRUD2 extends React.Component<CRUD2Props, any> {
} else if (!props.api && isPureVariable(props.source)) {
const next = resolveVariableAndFilter(props.source, props.data, '| raw');
if (!this.lastData || !isEqual(this.lastData, next)) {
if (!this.lastData || this.lastData !== next) {
store.initFromScope(props.data, props.source, {
columns: store.columns ?? props.columns
});