fix: 修复inputImage的receiver等参数如果使用变量无法及时获取变量最新值的问题。

This commit is contained in:
HuangJT 2023-05-07 09:42:59 +08:00 committed by GitHub
parent e9208b503f
commit 93cb1e3ca2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,7 +14,11 @@ import {FileRejection, ErrorCode, DropEvent} from 'react-dropzone';
import 'blueimp-canvastoblob';
import find from 'lodash/find';
import {Payload, ActionObject} from 'amis-core';
import {buildApi} from 'amis-core';
import {buildApi,
isEffectiveApi,
normalizeApi,
isApiOutdated,
isApiOutdatedWithData} from 'amis-core';
import {createObject, qsstringify, guid, isEmpty, qsparse} from 'amis-core';
import {Icon, TooltipWrapper, Button} from 'amis-ui';
import accepts from 'attr-accept';
@ -1913,6 +1917,20 @@ export default class ImageControl extends React.Component<
@FormItem({
type: 'input-image',
sizeMutable: false
sizeMutable: false,
shouldComponentUpdate: (props: any, prevProps: any) =>
!!isEffectiveApi(props.receiver, props.data) &&
(isApiOutdated(
props.receiver,
prevProps.receiver,
props.data,
prevProps.data
) ||
isApiOutdatedWithData(
props.receiver,
prevProps.receiver,
props.data,
prevProps.data
))
})
export class ImageControlRenderer extends ImageControl {}