On the problem of setstate in react

when I use react and ant desgin pro, I want to click a button to open the drawer on the right to get the data, but I can"t get it immediately. I need to repeat it two or three times. How to solve

related codes

showDrawer = (record, operation = "") => {
    const { dispatch, codeCheckInfo } = this.props;
    const { checkInfo } = this.state;
    
    this.setState({
      targetReposity: record,
      drawerVisible: true,
      operation: operation,
      commitsListLoading: true,
    })

    if( operation === "view") {
      dispatch({
        type: "reposity/fetchReposityCommits",
        payload: {
          project_id: record.id,
          page_size: 10,
        }
      });
    }else if( operation === "check") {
      dispatch({
        type: "codeCheck/fetchCodeCheckInfo",
        payload: {
          project_id: record.id,
        }
      });
      this.setState({
        checkInfo: codeCheckInfo,
      })
      console.log(checkInfo)
      const columnsCheck = [
      {
        title: "",
        dataIndex: "name",
        key: "name",
        render: (text, record) => <span>{record.name || "-"}</span>,
        sorter: (a, b) => a.name.length - b.name.length,
      },
      {
        title: "",
        dataIndex: "errors",
        key: "errors",
        render: (text, record) => <span>{record.errors || "-"}</span>,
      },
      {
        title: " ",
        dataIndex: "-",
        render: (text, record, index) => <a href="-sharp" onClick={() => this.showDetail(record)}></a>
      }
    ]
    
     {operation === "check" && authority.includes("code") && (
            <Table className={styles.check_table1}
              columns={columnsCheck}
              rowkey={record => record.name}
              dataSource={newData.length ? newData : []}
              // loading={commitsListLoading}
            /> 
          )}

what result do you expect? What is the error message actually seen?

the checkinfo I need is not updated the first time, but will not be updated until the second click!

Nov.10,2021

this is setState is asynchronous
`this.setState ({

)
    checkInfo: codeCheckInfo,
  }, ()=>{
   console.log(checkInfo) //
  })

`


I have extracted this part again into a new component, so that it does not affect

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-1ea6d4f-1e0e.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-1ea6d4f-1e0e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?