Help please with Repeater, delay updating textbox

Need help to fix an issue that is somehow bothersome. Have a repeater that shows events from a dataset, but the Participants # comes from another table and is the count of rsvp using the eventID.
The issue is that there is a delay of around 2 seconds to show the number. All the other values shows on page load since they are connected to the data.

In my code I have a dataset ready function that when the dataset triggers that is ready it then goes an updates the value.
I guess I have to put something on the $w . onReady (() => { }, but I don’t know what to do.

Please help me. Thanks.

export function dataset1_ready ( ) {
// console.log(“Updating Repeater on dataset ready”);
if ( $w ( “#dataset1” ). getTotalCount () > 0 ) {
$w ( “#repeater1” ). forEachItem ( ( $item , itemData , index ) => {

wixData . query ( “EventRSVP” )
. eq ( “eventID” , eventid )
. count ()
. then ( ( mynum ) => {
let numberOfItems = mynum ;
$item ( “#numRSVP” ). text = " " + numberOfItems ;
if ( numberOfItems >= numMaxPlayers )
{
$item ( “#btnJoin” ). hide ();
$item ( “#txtMessage” ). show ();
}
} );
}

In the statement $item ( “#numRSVP” ). text = " " + numberOfItems ; it looks like numberOfItems is a number and should be converted to text.

hey it’s being converted to a text by adding the double quotes: “”

I think my issue is around updating the textbox prior to displaying the page. Not sure what I need to do.

There is a great tutorial by Yisrael all about the how and whys of onReady…
https://www.wix.com/velo/forum/tips-tutorials-examples/w-onready-a-guide-for-the-perplexed.
Here’s opening code on my plant sale site that readies the page and two datasets:

$w . onReady ( function () {
$w ( “#2022PlantSale” ). onReady (() => {
$w ( “#2022customerInfo” ). onReady (() => {
zeroSelected ();
$w ( “#countNote” ). text = “” ; //Blank plant count error message
$w ( “#totalCost” ). text = “0” ;
$w ( “#ppWindow” ). hide ();
$w ( ‘#submit’ ). disable ()
});
});
});

Hope it helps.