Run Js query on page reload

Guys I have 3 query that changes the value of main query like in main query I am getting data of a field as true and false and based on that true and false I am changing its context to on-site and online

example 
 let x;
if(DisplayHappeningData.data['0'].happeningOnLocation === true)
  {
       x = "on-site";
    return x
  }
else
  {
    x= "online"
    return x
  }

but I when refresh it this query won't trigger , in advance option i have marked checked for RUN THE QUERY ON PAGE RELOAD , but it still not working kindly let me know if its possible to fix it

Okay Guys I have solved this by triggering all js query upon success of main query as showed in image