fix: refreshing the page after switching operators causes an error (#6781)

* fix: clear default value when switching operators to prevent filtering API errors

* fix: update EditOperator to set default value to null and assign componentProps to x-component-props

* fix: set field value and initialValue to null in EditOperator to ensure proper state management
This commit is contained in:
Zeke Zhang 2025-04-28 14:12:28 +08:00 committed by GitHub
parent 4f1e3df663
commit 6808620a3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -535,11 +535,19 @@ export const EditOperator = () => {
}
field.componentProps = componentProps;
fieldSchema['x-component-props'] = componentProps;
fieldSchema.default = null;
field.value = null;
field.initialValue = null;
dn.emit('patch', {
schema: {
['x-uid']: fieldSchema['x-uid'],
['x-component-props']: componentProps,
['x-filter-operator']: v,
// Clear default value when switching operators. Some operators require the default value to be an array,
// while others don't. Without clearing it, the filtering API would throw an error
default: null,
},
});
dn.refresh();