Is it an asynchronous problem that the access request data cannot be accessed?

problem description

getModelVersion () backend request data

Parameter limit

getCurrentData has only one parameter record

related codes

  getCurrentData = (record) => {
    const { searchParams } = this.state;
    const params = {
      status: searchParams.status,
      modelId: record.id,
    };
    getModelVersion(params).then((result) => { //
      if (result.length > 1) {
        return "";
      } else {
        return styles.disabledRow;
      }
    });
  }

Table in render

<Table
   className={styles.subTable}
   dataSource={this.state.SampleData}
   ....
   ....
   expandedRowKeys={expandedRowKeys}
   onExpandedRowsChange={this.onExpandedRowsChange}
   rowClassName={(record) => { return this.getCurrentData(record); }} // 
/>

what is the result?

getCurrentData returns undefined

Jun.02,2021

add a return and try

clipboard.png

Update

getCurrentData = (record) => {
    ...
    return Promise.resolve({}).then(=>{
        return getModelVersion(params) =>{
        .......
        }
    })
    ...
}

there should be something wrong with the getModelVersion method. Check whether this method is correct


the asynchronous bar


should not be used here.

use ES7 async await syntax.

  getCurrentData = async (record) => {
    const { searchParams } = this.state;
    const params = {
      status: searchParams.status,
      modelId: record.id,
    };
    const result = await getModelVersion(params);
    if (result.length > 1) {
        return '';
      } else {
        return styles.disabledRow;
      }
  }

1. Confirm whether the network request is sent
2. Show the getModelVersion code

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