“ InvalidStateError:DOM异常11:此事务已完成。”

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

我得到的例外-**“消息”:

“ InvalidStateError:DOM异常11:此事务已经 最终确定。成功或失败后提交事务 处理程序被调用。如果您使用Promise处理回调, 请注意,遵循A +标准的实现必须遵守 运行到完成语义,因此Promise解析发生在 随后的滴答声,因此在事务提交之后。” **

在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) => {
        });
      }

我正在将上述函数调用到仪表板页面,在此我将该返回约会添加到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,isRefreshing: false
         })
      })

我第一次获得10条记录,但是随后我得到DOM异常如何解决此问题:( 预先感谢

c68654626 回答:“ InvalidStateError:DOM异常11:此事务已完成。”

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2752687.html

大家都在问