"InvalidStateError: DOM Exception 11: This transaction is already finalized."

"InvalidStateError: DOM Exception 11: This transaction is already finalized."

我已经经历了很多问题可能是它的重复问题。:(

我遇到了异常 -**"message":

"InvalidStateError: DOM Exception 11: This transaction is already finalized. Transactions are committed after its success or failure handlers are called. If you are using a Promise to handle callbacks, be aware that implementations following the A+ standard adhere to run-to-completion semantics and so Promise resolution occurs on a subsequent tick and therefore after the transaction commits."**

在 React native android 应用程序中,我正在从离线数据中获取值以进行预约。我在其中完成了延迟加载。我的预约限额是 10.

我有一个平面列表,我正在检查平面列表 onEndReached 属性。

在 onEndReached 属性中,我从本地数据库获取值,这是我获取离线预约值的函数

  GetAllAppointment(data) {
    console.log("DATA IN -------->>", data);
    return new Promise((resolve, reject) => {
      this.initDB().then((db) => {
        db.transaction((tx) => {

          getObj('skipRecord', (id) => {

           var skipRecord = ((data.pageNumber - 1) * 10);

            let userAppointmentList = [];
            tx.executeSql("Select * from ios_Appointment where date >= " + nowDate + " and clinicianId =" + data.UserID + " and  fName Like '%" + data.searchKey + "%' OR lName Like '%" + data.searchKey + "%' OR address Like '%" + data.searchKey + "%' ORDER BY (date)").then(([tx, results]) => {
              if (results.rows.length > 0) {
                for (let i = skipRecord; i < results.rows.length; ++i) {
                  userAppointmentList.push(results.rows.item(i));
                }
              }
              let pages;
              pages = results.rows.length / records;
              pages = Math.ceil(pages)
              let items = {
                "Version": "1.2.3",
                "StatusCode": 200,
                "Message": "Success",
                "Result": userAppointmentList,
                "pagesCount": pages
              }

              resolve(results);

            }).then((result) => {
              // this.closeDatabase(db);
            }).catch((err) => {
              console.log("GetAllAppointment 1---->>", err);
            });
          }).catch((err) => {
            console.log("GetAllAppointment 2---->>", err);
          });
        }).catch((err) => {
        });
      }

我正在调用上面的函数到仪表板页面,我将这个 return 约会添加到 Flalist

const db = new Database();
export default class DashboardPage extends Component {
this.page = 1;
.
.
.
handleLoadMore = () => { 
       if (!this.state.showLoader && (this.state.pageCount > this.page)) {
         console.log("handleLoadMore page if------------------>>> ", this.state.showLoader);
         this.page = this.page + 1;
         this.setState({ showBottomLoader: true });
         this.getData(page);
      }
.
.
.
 getData(body) {

              let body = {
                  "pageNumber": page,
                  "searchKey": this.state.searchText,
                  "UserID": 1,
                  "currentDate": new Date().getTime()
               }


      db.GetAllAppointment(body).then((item) => {
         let newData;
         if (item) {
            if (body.pageNumber == 1) {
               newData = item.Result;
               this.state.appointmentList.concat(item.Result)
            } else {
               newData = this.state.appointmentList.concat(item.Result)
            }


            this.setState({
               showLoader: false,
               appointmentList: newData,
               pageCount: item.pagesCount,
               showBottomLoader: false,
               isRefreshing: false
            })
         }
      }).catch((err) => {
         this.setState({
            showLoader: false,
            appointmentList: newData,
            pageCount: item.pagesCount,
            showBottomLoader: false,
            isRefreshing: false
         })
      })

第一次我得到 10 条记录,但后来我得到 DOM 异常如何解决这个问题:( 提前致谢

终于解决了。

 GetAllAppointment(data) {
    console.log("DATA IN -------->>", data);
    return new Promise((resolve, reject) => {
      this.initDB().then((db) => {
        getObj('skipRecord', (id) => {
        db.transaction((tx) => {


在交易之前,我正在检查存储在本地的我的跳过记录值,然后在 id 执行 db.transaction 现在终于停止获取 DOM 异常 :)