Problem Displaying Repeater Properly

Hello all,

Wondering if someone can pinpoint this issue,

I’m displaying results in a repeater filtered where a field with ID in a collection matches the current logged in users ID. The repeater works but only sometimes. I have to refresh page for it work and sometimes it displays only some of the results…

This is the code I have

import wixData from ‘wix-data’;
import wixUsers from ‘wix-users’;

$w.onReady(() =>{
let user = wixUsers.currentUser;
let userId = user.id;
wixData.query(“PostBids”)
.eq(“title”, userId)
.find()
.then(() => {
$w(“#dataset1”).setFilter(wixData.filter()
.eq(“title”, userId) );

I’m pulling my hair out trying to understand why it works sometimes and other times i need to refresh page, any thoughts most appreciated.

Thanks

Hey Bidfix,

So you can simply paste this code above in your page or site code to solve the problem:

import wixData from 'wix-data';
import wixUsers from 'wix-users';
$w.onReady(() => {
   let user = wixUsers.currentUser; 
   let userId = user.id;
   wixData.query("PostBids")
   .contains("title", userId)
   .find()
   .then(() => {
       $w("#dataset1").setFilter(wixData.filter() 
       .contains("title", userId) );

Arman