Problem with database

starting sometime today, my forms will intermitently fail

$w(“#dataset1”).onReady( () => {
$w(“#dataset1”).setFieldValues( {
“title”: userId,
“email”: userEmail,
} )
.catch( (err) => {
let errMsg = err;
console.log (errMsg);
} );

wixcode-worker.js:1 An error occurred in one of datasetReady callbacks t {code: “DS_NO_CURRENT_ITEM”, message: “There is no current item”, name: “DatasetError”, stack: “DatasetError: There is no current item↵ at I (h…m/services/dbsm-viewer-app/1.241.0/app.js:6:49408”, Symbol(error was handled): true}

The error sometimes goes away after refreshing, but usually not.

This occurs with the live site,preview aswell as a backup from this morning.

https://www.ryanterminal.com/memberreservation

Hi,

The problem seems to be in the placement of the the dataset’s onReady() . which you have in the .then() of user.getMail() . The onReady() function is an event handler which handles the event of the dataset becoming available.

Instead you should call user.getMail() inside of the dataset’s onReady() function. Something like this:

$w("#dataset1").onReady(() => {
   console.log("dataset ready");
   //console.log ("UserID: "+userId);  
   //console.log ("Email: "+userEmail);
   let user = wixUsers.currentUser;
   userId = user.id;
   user.getEmail()
      .then((email) => {
         userEmail = email;
         changetext("#text62", email);
        });
   $w("#Reserve").enable();
});

Good luck,

Yisrael

Thanks for the reply. Yeah, that makes sense.
I originally had the execute the SetFields, because this was the earliest point I had the contact Emails.
I now moved all that code into OnBeforeSave, and all seems well.

One question… I would really like to access the Member/Contact info that’s in the built in user registration system… It can’t be that hard to expose the name/address/phone fields, can it? I mean, we had access to userId and Email already, right? Any idea when that will be available, because replicating it seems redudant, and would also get in the way of the booking/billing system I plan to use in future.

There’s no release date yet available for the Member/Contact system info. It’s in the works and will be available “Real soon now”.