expandedRowRender方法里面接口会无限请求,直到浏览器内存溢出 antd

如果把dispatch注释掉,每次点击都会打印一次,如果dispatch正常请求,会无限请求接口,不知哪里出问题了,页面其它dispatch请求都是正常的

图片描述

//model.js

effects: {
    *fetchOverviewDetails({ payload,callback }, { call, put }) {
      const response = yield call(queryOverviewDetails,payload);
      callback(response);
    },
  },

//index.js
expandedRowRender = (record, index, indent, expanded) => {
    console.log(record,expanded)
    if (expanded) {
      const { dispatch } = this.props;
      dispatch({
        type: 'submissionCentre/fetchOverviewDetails',
        payload: {
          trusteeid:record.Trusteeid,
        },
        callback: (res) => {
          console.log(res,'===')//res&&res.Info&&res.Info.length?res.Info:[]

        }
      });
    }
    return <Table rowKey={(record, index) => index} columns={columns} dataSource={[]} pagination={false} />;
  };
render() {
    return (
        <Table
            className="components-table-demo-nested"
            columns={columns}
            expandedRowRender={this.expandedRowRender}
            dataSource={treeNodeList}
            expandRowByClick={true}
        />
    )
}
阅读 4.4k
1 个回答

已经用别的方法实现了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题