If the antd form component passes the axios api check?

for example, for some duplicate name checks, you need to go to the backend to get the results through axios. Since the antd check is triggered every time the input box is changed, frequently called network calls will have great performance problems. Is there any way to control the frequency of calls?

        validateDupName (name) {
           axios.get(/api-path/)..... api
        }
        
        <FormItem
          label=""
          {...formItemLayout}
        >
          {getFieldDecorator("name", {
            rules: [
              {
                validator: validateDupName
              }
            ],
          })(
            <Input placeholder=""/>
          )}
        </FormItem>
        
Jun.21,2021

debounce
although form is monitoring whether your input conforms to rule, you can still listen to the onChange event of this input, so bind the request method for backend verification in the onChange event of input. Then packed with debounce, the frequency can be controlled.
when your request returns a failure, you can call setFields , and add the form error of antd


first of all, the verification of antd input depends on the rules you set. This rules basically only verifies whether the specification is entered, and you need to verify whether the duplicate name can pass onBlur

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3dc4b-2b101.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3dc4b-2b101.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?