Navigate to the dynamic item page from here: https://www.idassoc.com/product-information-encyclopedia
Example dynamic item page: https://www.idassoc.com/product-information-definition/Alt-Attribute
Both of these pages are slow to load, one is a dynamic category page the other a dynamic item page. It takes like over 5 seconds to load either and other people across the country have the same experience. Can someone take a look at the following code to see if there is something I can do to clean up or speed up performance? I don’t think it is the side bar element and there are no images. I have already reviewed the Wix support on how to improve speed but it doesn’t mention working with datasets.
Help appreciated thx!
Dynamic category page with repeater code:
import wixData from “wix-data”;
import wixLocation from ‘wix-location’;
import {local} from ‘wix-storage’;
export function searchBox_keyPress(event, $w) {
console.log($w(‘#searchBox’).value);
filter($w(‘#searchBox’).value);
let debounceTimer
function update() {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w(‘#searchBox’).value);
}, 100);
}
}
function filter() {
$w(‘#dataset1’).setFilter(
wixData.filter()
.contains(‘article’, $w(‘#searchBox’).value)
.or(
wixData.filter()
.contains(‘acronym’, $w(‘#searchBox’).value)
)
).then(()=> {
if ($w(‘#dataset1’).getTotalCount()===0) {
$w(‘#noResText’).show();
} else {
$w(‘#noResText’).hide()
}
const shortTextLength = 60;
let fullText;
let shortText;
$w(“#repeater”).forEachItem(($w,item) => {
fullText = $w(‘#dataset1’).getCurrentItem().definition;
if (!fullText.length) {
$w(‘#DefinitionText’).collapse();
} else
if (fullText.length <= shortTextLength) {
$w(‘#DefinitionText’).text = fullText;
} **else** {
shortText = fullText.substr(0, shortTextLength) + "...";
$w('#DefinitionText').text = shortText;
}
}
)
}
)
}
$w.onReady( function () {
$w(“#dataset1”).onReady( function () {
const shortTextLength = 60;
let fullText;
let shortText;
$w(“#repeater”).forEachItem(($w,item) => {
fullText = $w(‘#dataset1’).getCurrentItem().definition;
if (!fullText.length) {
$w(‘#DefinitionText’).collapse();
} else
if (fullText.length <= shortTextLength) {
$w(‘#DefinitionText’).text = fullText;
} **else** {
shortText = fullText.substr(0, shortTextLength) + "...";
$w('#DefinitionText').text = shortText;
}
}
)
}
)
}
)
Dynamic item page code for : https://www.idassoc.com/product-information-definition/Alt-Attribute
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;
// For full API documentation, including code examples, visit Velo API Reference - Wix.com
$w.onReady( () => {
$w(“#dynamicDataset”).onReady( () => {
let item = $w(“#dynamicDataset”).getCurrentItem();
if (item.aka === null ) {
// $w(“#aka”).show();
//} else {
$w(“#aka”).hide();
$w(“#aka”).collapse();
}
if (item.acronym === null ) {
// $w(“#acronym”).show();
// $w(“#text52”).show();
//} else {
$w(“#acronym”).hide();
$w(“#text52”).hide();
$w(“#acronym”).collapse();
$w(“#text52”).collapse();
}
if (item.relatedTerms === null ) {
// $w(“#relatedTerms”).show();
// $w(“#text53”).show();
// } else {
$w(“#relatedTerms”).hide();
$w(“#text53”).hide();
$w(“#relatedTerms”).collapse();
$w(“#text53”).collapse();
}
}
)
}
)
Thx for help!