fix: 配置面板首次变更无效 (#10936)

This commit is contained in:
Allen 2024-09-19 15:25:28 +08:00 committed by GitHub
parent cb5e5dca5e
commit ad77f24feb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 5 deletions

View File

@ -101,8 +101,6 @@ export function SchemaFrom({
return schema;
}, [body, controls, submitOnChange]);
const [init, setInit] = React.useState(true);
const themeConfig = React.useMemo(() => getThemeConfig(), []);
const submitSubscribers = React.useRef<Array<Function>>([]);
const subscribeSubmit = React.useCallback(
@ -149,8 +147,7 @@ export function SchemaFrom({
newValue = pipeOut ? await pipeOut(newValue, value) : newValue;
const diffValue = diff(value, newValue);
// 没有变化时不触发onChange
if (!diffValue || init) {
setInit(false);
if (!diffValue) {
return;
}
onChange(newValue, diffValue, (schema, value, id, diff) => {

View File

@ -229,7 +229,7 @@ export default class SelectControl extends React.Component<SelectProps, any> {
}
focus() {
this.input && this.input?.focus();
this.input && this.input?.focus?.();
}
getValue(