-
hi! i'm trying to perform an action whenever a navigation happens.
from the docs of
this feels strange, as a navigation is when you go from one page to another, rather than when the page is mounted (that's what if this behavior is intentional, then is there a workaround to skip the callback on first load? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can use the See https://kit.svelte.dev/docs/types#public-types-afternavigate |
Beta Was this translation helpful? Give feedback.
You can use the
type
property of the object passed to the callback to determine why the callback was invoked. When the value is "enter" you know it's the initial page hydration and you can skip your custom post-navigation logic.See https://kit.svelte.dev/docs/types#public-types-afternavigate