location.reload() takes too long, how to make it reload immediately?

70 Views Asked by At

I have a web app which needs to be reloaded if a certain button is pressed. The refreshing of the page supposed to happen then moment I press the button and then I do some computation. The problem is that even though the reload is called before the computation, the computation happens before the reload.

Is there any way to resolve this?

eel.expose(ReloadPage);
function ReloadPage()
{
  location.reload();
}


    def LoadButtonFunc(self):
        chosen_load_file = filedialog.askopenfile(title="Load testing session" ,mode = 'r',filetypes = [("Pashosh file", "*.psh")])
        if chosen_load_file == None:
            return
        
        # reset all data before loading
        eel.ReloadPage()                    
        self.DB.clear()                     
        self.global_row_index = 0
        self.input_dir = None

        [self.DB, self.input_dir] = json.load(chosen_load_file)
        self.WorkDirButtonFunc(self.input_dir)

        for elem in self.DB:
            eel.BuildRowUI(self.matlabTests_list, self.global_row_index, elem)
            self.UpdateRowIndex()
0

There are 0 best solutions below