What is the reason for subsequent root navigation not triggering hooks handle function? #10945
-
I couldn't find anything about it in the docs, but I cannot understand that as AFAIK all requests should go thru hooks.server.js if defined. so just to clarify, the flow:
I don't plan for root path to be authed, but if somebody wanted that then it will be a problem. I just stumbled upon this by accident. EDIT: EDIT2: I think it doesn't run if root page doesn't have +page.server.js file. Just tested that and it appears that's how it works. Anybody can point me to the docs where that is mentioned? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
As far as I recall, it's not explicitly mentioned anywhere in the documentation. I'd highly encourage you to submit an issue for this. The reasoning for your handle function running depends on how your project setup. Assuming the page options are left as default ( The link below is an example of the server hook |
Beta Was this translation helpful? Give feedback.
As far as I recall, it's not explicitly mentioned anywhere in the documentation. I'd highly encourage you to submit an issue for this.
The reasoning for your handle function running depends on how your project setup. Assuming the page options are left as default (
ssr
andcsr
enabled), the initial request will server-side render the page (goes through the server hookhandle
). Subsequent requests are client-side rendered, so only if they have a server load function, a request will be sent to request the__data.json
file, which goes through thehandle
hook once again. Otherwise, they never trigger the server hookhandle
.The link below is an example of the server hook
handle
logging any requ…