plechelmus
White flash on page reload
Hi, when reloading a page, I get a white flash. This is happening since a recent update (or change in my code), it was not there before. How can I pinpoint the cause of this?
A reproduction in production can be found here: https://hetbrugrestaurant.nl/
12 replies
runtimeConfig differs on server-render vs client-rendered page
Hi, on intial page load my runtimeConfig uses the default values I set in nuxt.config.ts and does not use any NUXTPUBLIC... overrides from the environment. If I navigate to different pages, this runtimeConfig stays.
But when I go to a page that only has a client component, it loads the correct runtimeConfig with the values from my environment. If I navigate to page afterwards it also keeps this runtimeConfig. Reloading the page reverts the runtimeConfig back to the default one.
I use the runtimeConfig to point to the resource to load. So you can imagine this is unwanted behaviour since it now shows two different resources based on which page was visited first.
What can be the issue of this? I am using the latest version of Nuxt and it is running inside Docker. If I go inside docker and run echo $NUXTPUBLIC... it shows the correct values, but they are not used by the application when first loading the page.
4 replies
Adding an auth token to $fetch only works after full page refresh, how to fix?
Hi, I am trying to add my auth token to fetch requests if the user is authenticated, and I have created a Nuxt plugin for this that exposes a custom $fetch instance.
However, when I run this code it works only after I perform a full page refresh after loggin in. When logging in and navigating to a page that makes a request that requires a token, the token is not included. Only when I fully refresh the page, the token seems to be added.
How can I fix this?
2 replies