ant-design / pro-components

🏆 Use Ant Design like a Pro!
https://pro-components.antdigital.dev
MIT License
4.04k stars 1.29k forks source link

ProFormSelect远程搜索,选择了一项option后,request再次请求了(导致option会清空或者查全量数据) #8302

Closed hans000 closed 2 weeks ago

hans000 commented 1 month ago

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

🐛 bug 描述

ProFormSelect远程搜索,选择了一项option后,request再次请求了(导致option会清空或者查全量数据)

📷 复现步骤

🏞 期望结果

选择选项时不应该再次请求

💻 复现代码

  <ProFormSelect
    showSearch
    request={({ keyWords }) => {
      console.log('fetch...')
      return new Promise(reslove => {
        setTimeout(() => {
          reslove(Array.from({ length: 10 }, (_, i) => ({
            label: 'a' + i + '-' + keyWords,
            value: 'a' + i + '-' + keyWords
          })))
        }, 300);
      })
    }}
  />

© 版本信息

🚑 其他信息

hans000 commented 2 weeks ago

应该是antd的onSearch默认行为