In the login page I save the user ID in the session to easily perform checks on the website. After the value is stored in the session, the new page is loaded where I retrieve the user ID from the session and make the main query to load the main information for that page. It fails because the API loads faster than the information from the session. I tried to display the session value, and initially, it is null, then it loads the value. Why is it null for 0.3/0.5 seconds before loading the real value? Shouldn't it be real-time since it is saved in the session (on the browser)? Delaying the main query for 0.3/0.5 seconds to allow the session to load would increase the page loading time too much. Is there a solution to retrieve that value instantly? I tried in the loading page event save the session in a variable, than calling the API with the value from the variable and it works, but takes much time to load the page.