coded repeater disappears after a bit of time

Hi there,
I have encountered this issue a few days ago and for the life of me I cannot figure out what is wrong

Here is what happens in pictures:


then:


finally:

I have a repeater that is populated by code, it does display correctly. After a bit of time (less than 2 seconds) it just starts disappearing (first the profile picture then the name). I am further confused by the fact that if I click on it before anything disappears, I correctly retrieve the ID of the user affiliated to the element, however when I click on it after it has disappeared, the ID appears to have an extra “_p_1” at the end (“8fa24dea-4723-4c0c-bc53-3eb7c685036d” becomes “8fa24dea-4723-4c0c-bc53-3eb7c685036d_p_1”)

The repeater works perfectly well when I use this function (it does not disappear, ID works well):

function setSidePanel(userId, j) {
    let container, img, name;
    if (j == 0) {
        container = "#repeaterInUser";
        img = "#imageIn";
        name = "#textNameIn";
        dataset = "Members";

    } else if (j == 1) {
        container = "#repeaterSciUser";
        img = "#imageSci";
        name = "#textNameSci";
        dataset = "InfluencerMembers";
    }
    wixData.query(dataset)
        .eq("_id", userId)
        .find()
        .then(async (results) => {
            let currentUser = [];
            for (let i = 0; i < results.items[0].interactions.length; i++) {

                let x = results.items[0].interactions[i];
                let y = [{ '_id': x }];
                currentUser = currentUser.concat(y);
            }

            $w(container).onItemReady(async ($w, itemData, index) => {
                $w(img).src = (await getProfile(itemData._id, 1, 1, dataset));
                $w(name).text = (await getProfile(itemData._id, 0, 1, dataset));
            });

            $w(container).data = currentUser;

        });

however this function causes it to disappear:

function setSidePanelFilter(filter) {
    let container, img, name, j;
    j = parseInt(memory.getItem("j"));
    if (j == 0) {
        container = "#repeaterInUser";
        img = "#imageIn";
        name = "#textNameIn";
        dataset = "InfluencerMembers";

    } else if (j === 1) {
        container = "#repeaterSciUser";
        img = "#imageSci";
        name = "#textNameSci";
        dataset = "Members";
    }
    wixData.query(dataset)
        .contains("fullName", filter)
        .find()
        .then(async (results) => {
            if (results.items.length > 0) {
                let currentUser = [];
                for (let i = 0; i < results.length; i++) {

                    let x = results.items[i]._id;
                    let y = [{ '_id': x }];
                    currentUser = currentUser.concat(y);
                }

                $w(container).onItemReady(async ($w, itemData, index) => {
                    $w(img).src = (await getProfile(itemData._id, 1, 1, dataset));
                    $w(name).text = (await getProfile(itemData._id, 0, 1, dataset));
                });

                $w(container).data = currentUser;

            } else {

                console.log("query empty")
            }

        });
}

Please let me know if I can provide any additional information

You should add a console.log() statement to see if you have any results from your query. Seems as if the filter code does not return any results, and then the Repeater is refreshed with no data and ends up with nothing to display.

Your catching it before anything disappears just means that the Repeater is in the process of being refreshed, and that that item hasn’t yet been refreshed out of existence.

Just as an aside, you are using incorrect terminology. The variable dataset is actually being set to a database collection and not a dataset. A dataset is a thing (not really a page element, but sort of) that connects page elements to data in a database collection.

The query does work properly, I have no doubt about that:


it’s all mock data btw
but that’s the thing I am very confused about, I seemingly didn’t make any changes to this part of the code since last time I worked on the website, and it did work properly
any other idea?

thanks for the heads up! I appreciate it