Corvid code working on desktop not mobile

Hi everyone, I have a corvid or Wix problem that maybe someone is aware of? I wrote some corvid code that appears to work on desktop (chrome) but NOT mobile. Is there something I’m doing wrong?

The code is for an Pay Now button. When the user clicks it, the item (Sneaker) in the repeater will go to the cart. I already created a product id in the “Stores/Products” database for the item (being pulled from the “Sneakers” database - both have the same id’s. On desktop, it works fine. On mobile, I don’t know what happens but I’ve attached the error code. I’ve attached my code as well. There are other things happening in the background (an email notification being sent through SendGrid, updating the “Sneakers” database) but based off of the error, it looks as if the _id in the “Stores/Products” database is not being found (even though it’s being found via Desktop and working just fine)
H


Here is the code:

$w(“#requestDisplaySenderTrader”).onClick( (event) => {
let $item = $w.at(event.context);
let desc = $item(‘#shoeTradeeId’).text;
console.log(“Shoe Id:” + desc);
if($item(“#senderStatusTrader”).label === “Accepted”){
wixData.query(“Stores/Products”)
.eq(“description”, desc)
.find()
.then( (results) => {
wixStores.getCurrentCart()
.then((cartData) => {
let cartId = cartData._id;
let cartLineItems = cartData.lineItems;
$item(‘#dataset2’).setFieldValue(“senderStatusTrader”, “Accepted”);
$item(‘#dataset2’).setFieldValue(“traderProductId”, results.items[0]._id);
$item(‘#dataset2’).setFieldValue(“traderCartId”, cartData._id);
$item(‘#dataset2’).save();
})
.catch((error) => {
console.log(error);
});

	$w("#shoppingCartIcon1").addToCart(results.items[0]._id).then(() => { 
	wixLocation.to("https://www.houseoftradeinc.com/cart-page"); 
	
var tradeeName;  
var tradeeEmail; 
var traderEmail;		 
	tradeeEmail = $item("#tradeeEmail").text; 
	traderEmail = $item("#traderEmail").text; 
		let body = { 
			"tradee_name": $item("#tradeeName").text,  
			"tradee_product_style": $item("#tradeeStyle").text, 
			"tradee_product_size": $item("#tradeeShoeSize").text, 
			"tradee_product_brand": $item("#tradeeBrand").text, 
			"tradee_product_condition": $item("#tradeeProductCondition").text, 
			"tradee_image": $item("#tradeeImage").src,				 
			"trader_name": $item("#traderName").text, 
			"trader_product_style": $item("#traderStyle").text, 
			"trader_product_size": $item("#traderShoeSize").text, 
			"trader_product_brand": $item("#traderBrand").text, 
			"trader_product_condition": $item("#traderProductCondition2").text, 
			"trader_image": $item("#traderImage").src,					 
		}; 
	});		 
	}) 
} 
////// 
if($item("#senderStatusTrader").label === "Declined"){ 
	$item("#requestDisplaySenderTrader").hide(); 
	$item("#requestDisplaySenderTrader").collapse(); 
} 
//// 
//let desc = $item('#shoeId').text; 
if($item("#senderStatusTrader").label === "Submitted"){ 
wixData.query("Stores/Products") 
	.eq("description", desc) 
	.find() 
	.then( (results) => {			 
		$item('#dataset2').remove(); 
		//$item('#dataset2').save(); 
		console.log("Cancelled!"); 
		wixLocation.to("https://www.houseoftradeinc.com/my-trades"); 
	});	 
} 
	///	 
});	 

You can go to https://www.houseoftradeinc.com/

You’ll need to create an account, add a shoe ( https://www.houseoftradeinc.com/account/my-sneakers ), and then create another account to trade to and from. You can then go to browse ( https://www.houseoftradeinc.com/browse ) to trade the shoe from the other account you created. You will notice that it works on desktop, but not mobile.

You’re missing a return:

return wixStores.getCurrentCart()
  • it’s better not to nest promises, but chain them:
wixData.query("Stores/Products")
		.eq("description", desc)
		.find()
		.then( (results) => {			
		return wixStores.getCurrentCart();
		})
		.then((cartData) => {
		//etc.....

		})
		.catch((error) => console.log(error));

Thanks! I’ll go ahead and try that. However, I’m not sure if that is what will solve the problem? Look at my screencast of the problem here: https://www.screencast.com/t/w6Gm09swpT

On the screenshot you posted, there is “Uncaught…at ”. click the link to see where exactly the error is.

Ah yes, I was able to fix that - that doesn’t appear anymore but the problem persists

Hi Melissa,
Thanks for making that video—it’s really helpful! Since our awesome Corvid Master J.D. wasn’t able to solve the problem, I suspect this is related to our performance rollout. I’ll share your issue with our QA team and have them investigate. In the meantime, let us know if you resolve it!

@marlowe-shaeffer Awesome, thanks for passing on the information! I’ll definitely let you know if I happen to resolve it. Thanks!

@melissa-hong Hi again,
This doesn’t seem related to our rollout, so we’re going to need some more time to investigate. Thanks in advance for your patience, and we’ll let you know as soon as we identify the issue.

Great, thanks for the update!

Hi Melissa,
Update: there’s an issue in your code that we still need to debug. Sorry for the delay. If you’ve already resolved it, please let me know. Thank you.

Thanks for the update! Do you know which part of the code appears to have the bug? It seems odd considering that it works on desktop and on the mobile devices in inspect mode, but not on the actual iPhone 11. Please let me know where you think the bug is. Thx!