Hello,
I am getting this error on my live site: TypeError: Cannot read property ‘type’ of undefined
However, in my preview site I do not have any problems.
This pertains to JS that runs at https://www.ryanandkirsten.com/rsvp.
I use this function to perform a fuzzy search against a database collection as the user types in the input.
export function fuzzyGuestSearch(event, $w) {
let searchInput = $w(‘#input1’).value
var options = {
shouldSort: true ,
includeScore: true ,
threshold: 0.5,
location: 0,
distance: 50,
maxPatternLength: 32,
minMatchCharLength: 3,
keys: [‘fullName’]
};
if (searchInput.length > 0) {
wixData.query(“wedding-guests”)
.limit(1000)
.ne(“rsvpComplete”, true )
.find()
.then((results) => {
let list = results.items;
var fuse = new Fuse(list, options); // “list” is the item array
return fuse.search(searchInput);
})
.then((result) => {
if (result.length > 0) {
let score = result[0].score
if (score <= .4) {
let guestInput = result[0].item
session.setItem(“user”, JSON.stringify(guestInput))
console.log("Dataset is ready to be filtered by " + JSON.stringify(guestInput))
$w(‘#button1’).enable();
} **else** {
console.log("No Results")
$w('#button1').disable();
}
}
})
}
}
Then when the user clicks the next button I run this code inside of onReady
$w(‘#button1’).onClick((event, $w) => {
let user = JSON.parse(session.getItem(“user”))
let groupKey = user.groupKey
let guest = user.guestAllowed
console.log(guest)
$w("#dataset2")
.setFilter(wixData.filter().eq("groupKey", groupKey))
.then(() => {
console.log("DataSet is now Filtered");
if (guest === true ) {
$w(‘#box1’)
.expand()
.then($w(‘#slideshow1’)
.changeSlide(1))
} else {
$w(‘#slideshow1’)
.changeSlide(1)
}
})
. catch ((err) => {
console.log("There was an error filtering the dataset: " + err);
})
});
Please let me know if there is any other information I can provide.