ant-design / pro-components

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

🐛[BUG]报错Objects are not valid as a React child (found: object with keys {submitButtonProps}) #663

Closed haoyinag closed 4 years ago

haoyinag commented 4 years ago

🐛 bug 描述

重新编译项目,出现Objects are not valid as a React child (found: object with keys {submitButtonProps}) ......

📷 复现步骤

开始排查: 1、进ProTable源码,甚至全局搜索,都无法找到submitButtonProps 2、哪怕注释protable的所有props,依然报错

🏞 期望结果

哎,实在太多坑了。 哪怕有报错信息,然而没啥用,排了一下午依然无法解决

💻 复现代码

  1. 报错信息
    Error: Objects are not valid as a React child (found: object with keys {submitButtonProps}). If you meant to render a collection of children, use an array instead.
    in Space (created by Actions)
    in Actions (created by BaseForm)
    in div (created by Context.Consumer)
    in Col (created by BaseForm)
    in div (created by Context.Consumer)
    in Row (created by ResizeObserver)
    in ResizeObserver (created by BaseForm)
    in form (created by ForwardRef(Form))
    in ForwardRef(Form) (created by ForwardRef(InternalForm))
    in SizeContextProvider (created by ForwardRef(InternalForm))
    in ForwardRef(InternalForm) (created by BaseForm)
    in ConfigProviderWarp (created by BaseForm)
    in BaseForm (created by QueryFilter)
    in QueryFilter (created by FormSearch)
    in div (created by FormSearch)
    in FormSearch (created by ProTable)
    in div (created by ProTable)
  2. 代码
    <ProTable<DeliverStaffItem>
        actionRef={actionRef}
        rowKey="id"
        toolBarRender={(action, { selectedRows }) => [
          <Button
            type="primary"
            disabled={!(selectedRows && selectedRows.length > 0)}
            onClick={() => {
              exportData(`${API_DELIVERY}${exportStaff}`, {
                idList: selectedRows?.map((item) => item.id).join(),
                empOrgan: EMP_ORGAN,
              });
            }}
          >
            导出
          </Button>,
          <Button
            type="primary"
            disabled={!(selectedRows && selectedRows.length > 0)}
            onClick={() => {
              handleShowDeployModal(true);
              handleDeployRows(selectedRows || []);
            }}
          >
            批量调配
          </Button>,
          <Button
            type="primary"
            onClick={() => {
              handleModalVisible(true);
              handleFormType("add");
              handleDataItem(dataItem);
            }}
          >
            添加员工
          </Button>,
          <Button
            type="primary"
            onClick={() => {
              history.push({
                pathname: "/staff/deliverOff/list",
                query: { type: EMP_ORGAN },
              });
            }}
          >
            已注销员工
          </Button>,
        ]}
        params={{ empOrgan: EMP_ORGAN }}
        request={async (params) => {
          let newParams = { ...params, size: params && (params.pageSize || 1) };
          delete newParams.pageSize;
          const res = await queryDeliveryStaff(newParams);
          return Promise.resolve({
            ...res,
            data: res.records,
            pageSize: res.size,
            success: true,
          });
        }}
        dateFormatter={"string"}
        columns={columns}
        rowSelection={{
          onChange: (rowSelection) => {
            // handleSelectIds(rowSelection);
          },
        }}
      />

© 版本信息

    "@amap/amap-jsapi-types": "^0.0.4",
    "@ant-design/pro-layout": "^5.0.9",
    "@ant-design/pro-table": "^2.2.7",
    "@types/jest": "^25.2.1",
    "@types/react": "^16.9.34",
    "@umijs/hooks": "^1.9.2",
    "@umijs/preset-react": "1.x",
    "@umijs/test": "^3.1.1",
    "antd-dayjs-webpack-plugin": "^1.0.0",
    "cross-env": "^7.0.2",
    "html2canvas": "^1.0.0-rc.5",
    "lint-staged": "^10.0.7",
    "postcss-px-to-viewport": "^1.1.1",
    "prettier": "^2.0.5",
    "react": "^16.12.0",
    "react-amap": "^1.2.8",
    "react-dom": "^16.12.0",
    "stylus": "^0.54.7",
    "stylus-loader": "^3.0.2",
    "ts-md5": "^1.2.7",
    "typescript": "^3.8.3",
    "umi": "^3.1.1",
    "yorkie": "^2.0.0"

🚑 其他信息

如果要提供复现demo就算了,我就是个铲屎官-.-

chenshuai2144 commented 4 years ago

清空然后更新依赖依赖。这个是因为版本不匹配的问题

haoyinag commented 4 years ago

0.0

lianzhao commented 3 years ago

同样的问题能具体说说怎么解决么?尝试了

rm yarn.lock
rm -rf node_modules/
yarn cache clean
tyarn cache clean
tyarn

之后还是同样的问题

chenshuai2144 commented 3 years ago

看看 package.json 是不是锁包了