Textbox not updating as expected - Error

Hi, Working on a page to allow users to register to events.
Have a repeater that is linked to a dataset.
On page loading everything loads correctly and all text boxes have the correct information.

Been trying to update the # of Participants every time some drop outs or join event. When you click “Drop Out” it deletes the record from another table I used to maintains the RSVP. The issue is that it deletes the records, but does not update as expected.
Image#1

Here I clicked dropout and shows undefined. If I clicked to join the event adds the records and stays undefined.
#image2

Here is the code I use to update the table
async function dataUpdater ( myId , myData ) {
if ( myId === 0 ){
const results = await wixData . insert ( “myRSVP” , myData )
. catch ( ( err ) => {
console . log ( err );
} );
}
else
{
const results2 = await wixData . remove ( “myRSVP” , myId )
. catch ( ( err ) => {
console . log ( err );
} );
}
}

Here is function that I use to get the # of RSVP.
function getParticipants ( myeventid ){
var numberOfItems ;
console . log ( "Refreshing Participiant " + myeventid );
wixData . query ( “myRSVP” )
. eq ( “participantID” , userId )
. eq ( “eventID” , myeventid )
. count ()
. then ( ( num ) => {
// console.log(numberOfItems);
let numberOfItems = num ;
return numberOfItems ;
} )

Here is the code I use to insert/remove, update label of button and update the textbox.
// add the item to the collection
dataUpdater ( 0 , toInsert );
// update buttons accordingly
$w ( “#btnJoin” ). label = “Drop Out” ;
let numRSVP = getParticipants ( myeventID );
console . log ( numRSVP );
$w ( “#numRSVP” ). text = " " + numRSVP ;

Any ideas what could be the issue?

found the solution, by adding a settimeout to the getParticipants function. If someone see a better solution post it pleaes.