Replies: 1 comment
-
This sounds similar to this issue that also is difficult to reproduce. The load function on +layout.server and +page.server.ts seems to be called on a client side fetch for some reason during dev mode: https://stackoverflow.com/questions/78206769/layout-svelte-ts-and-page-server-ts-are-executed-twice-after-a-fetch-is-done |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a logout route that in the load function deletes an account token cookie and redirects back to the root
/
. However, every once in a while my layout throws the following error:This is because (to my knowledge what's happening) is:
/
/
is loading), because it's still set sometimes (not sure why, but I see it clearly when I console log the cookies.get on the account token. (The reason that the layout ALSO tries to delete the cookie is the layout will fetch the customer information associated with the cookie, and if null is returned than the cookie expired so layout will delete it.)Deleting a cookie though shouldn't have this happen? It seems somehow it's almost like the cookies.delete in the layout.server.ts is running after the return statement, despite the fact that it very much isn't after that statement, or in any sort of Promise.
I couldn't reproduce this yet outside of my own codebase, which I can't share (so I didn't file a bug report), but it's basically this system here. (Go to /login, then /logout)
Beta Was this translation helpful? Give feedback.
All reactions