Repeater with filter - why is mine so slow?

Hi everyone,

I’m building a gallery with photos in three categories - MUSIC, DOCUMENTARY, COMEDY. To do this I have a repeater connected to a dataset with all the images & info, and buttons that filter the repeater to only show items in those categories, plus a button ALL that shows everything.

This is working successfully using the code shown below, my problem is that there’s a painful delay of 2-3 seconds after each button press before the results are updated.

This is still in test phase with only 5 entries in my database (so it’s not searching through a huge list of data) and the delay occurs even when there are no images attached (so it’s not related to large image load times).

Any suggestions as to how I could fix this delay would be very much appreciated.

My code:

import wixData from "wix-data";
$w.onReady(function () {
    });
 
export function allButton_click(event) {

    console.log("all button");
$w("#dynamicDataset").setFilter(wixData.filter().eq("all", Boolean(true)));}

export function musicButton_click(event) {
    console.log("music button");
$w("#dynamicDataset").setFilter(wixData.filter().eq("music", Boolean(true)));

}

export function docButton_click(event) 
{console.log("documentary button");
$w("#dynamicDataset").setFilter(wixData.filter().eq("doc", Boolean(true)));

}

/**
 *  Adds an event handler that runs when the element is clicked.
 *   @param {$w.MouseEvent} event
 */
export function comedyButton_click(event) {
 // This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4
 // Add your code for this event here: 
console.log("comedy button");
$w("#dynamicDataset").setFilter(wixData.filter().eq("comedy", Boolean(true)));}

Figured this out in case anyone finds this thread - it was simply that I hadn’t yet published my site, it was only running slow in Preview mode

Thanks for pointing this out. Running a site from the Editor (Preview) uses a different rendering engine which, as you correctly point out, is slower than the Live rendering. The Preview rendering will eventually use the same render engine as Live, but there currently is no ETA.