diff --git a/packages/amis/src/renderers/Form/DiffEditor.tsx b/packages/amis/src/renderers/Form/DiffEditor.tsx index 7a7befd1c..7eeb321ca 100644 --- a/packages/amis/src/renderers/Form/DiffEditor.tsx +++ b/packages/amis/src/renderers/Form/DiffEditor.tsx @@ -199,7 +199,14 @@ export class DiffEditor extends React.Component { value !== prevProps.value && !this.state.focused ) { - this.modifiedEditor.getModel().setValue(normalizeValue(value, language)); + this.modifiedEditor.getModel().setValue( + isPureVariable(value as string) + ? normalizeValue( + resolveVariableAndFilter(value || '', data, '| raw', () => ''), + language + ) + : normalizeValue(value, language) + ); } } diff --git a/packages/amis/src/renderers/SearchBox.tsx b/packages/amis/src/renderers/SearchBox.tsx index 0ff6d8b1b..9d9fe0100 100644 --- a/packages/amis/src/renderers/SearchBox.tsx +++ b/packages/amis/src/renderers/SearchBox.tsx @@ -178,9 +178,10 @@ export class SearchBoxRenderer extends React.Component< this.setState({value: ''}); } } - setData(value: any) { - this.setState({value}); + if (typeof value === 'string') { + this.setState({value}); + } } render() {