I have a Wixdata.Query statement that I’m running when an image is clicked.
wixData.query(“collection”)
.eq(“id”, wixUsers.currentUser.id)
.eq(“matchId”, evt.context.itemId)
.find()
.then((matchingResults) => {
if (matchingResults.items.length === 0) {
item = null;
} else {// match found
item = matchingResults.items[0];
})
The strange thing is that when this query runs with the same parameters it somethings gives a correct result and sometimes it does not give any result at all. The collection is not changed during the query runs.
The parameters are always correct and the code gets to the Wixdata.query statement. (I have included logging statements in my code to see if it actually gets executed.)
When it does not return any value the .then statement is not executed and there is no error that is thrown.
Is this a known issue?
Thank you.