fix: update ProviderOptions.tsx (#5949)

This commit is contained in:
chenos 2024-12-26 18:03:30 +08:00 committed by GitHub
parent d2bd8cdf48
commit 6412e08b3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,16 +10,16 @@
import { FormLayout } from '@formily/antd-v5';
import { Field } from '@formily/core';
import { RecursionField, Schema, observer, useField, useForm } from '@formily/react';
import React, { useEffect, useState } from 'react';
import { useUpdateEffect } from 'ahooks';
import React, { useState } from 'react';
import providerTypes from './providerTypes';
const Verification = observer(
(props) => {
const form = useForm();
const field = useField<Field>();
const [s, setSchema] = useState(new Schema({}));
useEffect(() => {
const [s, setSchema] = useState(new Schema(providerTypes.get(form.values.type) || {}));
useUpdateEffect(() => {
form.clearFormGraph('options.*');
setSchema(new Schema(providerTypes.get(form.values.type) || {}));
}, [form.values.type]);