Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛[BUG] ProTable requests 会发送两次请求 #8559

Closed
kopa-kongpan opened this issue Jul 10, 2024 · 2 comments
Closed

🐛[BUG] ProTable requests 会发送两次请求 #8559

kopa-kongpan opened this issue Jul 10, 2024 · 2 comments

Comments

@kopa-kongpan
Copy link

kopa-kongpan commented Jul 10, 2024

🐛 bug 描述

ProTable requests 会发送两次请求

📷 复现步骤

🏞 期望结果

💻 复现代码

<ProTable
        rowSelection={{
          // 自定义选择项参考: https://ant.design/components/table-cn/#components-table-demo-row-selection-custom
          // 注释该行则默认不显示下拉选项
          selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
        }}
        tableAlertRender={({
                             selectedRowKeys,
                             onCleanSelected,
                           }) => {
          setCurrentReqId(selectedRowKeys)
          return (
            <Space size={24}>
            <span>
              已选 {selectedRowKeys.length} 
              <a style={{marginInlineStart: 8}} onClick={onCleanSelected}>
                取消选择
              </a>
            </span>
            </Space>

          );
        }}
        columns={columns}
        request={async (params, sorter, filter) => {
          console.log("++++++++++++++++")
          if (!filter.type) {
            filter.type = ['FuR']
          }
          if (!filter.version) {
            filter.version = ['RB_V5R15C10']
          }
          const datasource = await getReqItem(params, sorter, filter)
          setParamsFilter(datasource.filter_items)
          return datasource
        }}
        rowKey="reqId"
        pagination={{
          showQuickJumper: true,
        }}
        search={{
          layout: 'vertical',
          defaultCollapsed: false,
        }}
        dateFormatter="string"
        toolbar={{
          title: '特性表格',
          // tooltip: '这是一个标题提示',
        }}
        toolBarRender={() => [
          <Button type="primary" key="primary" onClick={onExportExcel}>
            下载特性excel
          </Button>,
          <Button type="primary" key="primary" onClick={onExportRiskExcel}>
            下载风险excel
          </Button>,
        ]}
      />

© 版本信息

  • ProComponents 版本: 2.6.48
  • umi 版本 2.2.2
  • 浏览器环境
  • 开发环境 windows

🚑 其他信息

@ChuTingzj
Copy link

request 里 setParamsFilter 触发依赖更新了

@chenshuai2144
Copy link
Contributor

onInlt 慢一些的,oinit 之后还会执行一下,可能params 就发生变化了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants