Webpage takes very long before it runs $w.onReady() function

Hey everybody,

When my site appears to be fully loaded, it still takes about a minute before my code that I put in the $w.onReady() function works.

I can’t figure out why it takes so long for my code to start working. Could somebody help me with this?

Here’s the url and the code of the webpage:
http://ruudvandoorn. com/

import wixData from ‘wix-data’ ;

const databaseName = ‘#dataset1’ ;
const databaseField = ‘category’ ;
const ST = $w ( ‘#selectionTags1’ );

$w . onReady ( async function () {
const selectedTag = $w ( ‘#selectionTags1’ ). value ;
let filter = wixData . filter ();

**if**  ( selectedTag . length  >  0 ) { 
    filter  =  filter . hasSome ( databaseField ,  selectedTag ); 
} 

$w ( databaseName ). setFilter ( filter ); 
ST . onChange ( **async**  () => { 
    **let**  VALUE  =  ST . value ; 
    **let**  LENGTH  =  VALUE . length ; 

    //console.log("Value before ---> SHIFT: ", VALUE) 
    **for**  ( **var**  i  =  0 ;  i  <  LENGTH  -  1 ;  i ++) { 
        **if**  ( LENGTH  >  1 ) { 
            **let**  oldVALUE  =  **await**  VALUE . shift () 
            console . log ( "Old VALUE ---> " ,  oldVALUE ) 
            ST . value  = [], 
                ST . value  =  **await**  VALUE 
            **let**  currentSelection  =  VALUE ; 
            //console.log("Current selected VALUE ---> ", VALUE) 
        } 
    } 

    **const**  selectedTag  =  $w ( '#selectionTags1' ). value ; 
    **let**  filter  =  wixData . filter (); 

    **if**  ( selectedTag . length  >  0 ) { 
        filter  =  filter . hasSome ( databaseField ,  selectedTag ); 
    } 

    $w ( databaseName ). setFilter ( filter ); 
}); 

});