Merge pull request #8015 from igrowp/fix-some-bug

fix: diffEditor组件在某些场景下使用变量时导致页面卡死的问题
This commit is contained in:
wutong 2023-09-06 15:26:33 +08:00 committed by GitHub
commit 60e2743cf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -199,7 +199,14 @@ export class DiffEditor extends React.Component<DiffEditorProps, any> {
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)
);
}
}

View File

@ -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() {