beforeNavigate fires when you click a link to the page you're on #12861
-
The docs say "A navigation interceptor that triggers before we navigate to a new URL" but that doesn't seem to be the case. I'm using beforeNavigate to clear IntersectionObserver objects like:
And when I'm on the home page and I click a link to the home page, that fires and kills the observer so it doesn't work on the page. I could do:
But that feels like it shouldn't be necessary. Is this a bug with beforeNavigate or am I doing this in a weird way? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Can't you use regular Svelte hooks like Also, how is the observer created? If it's |
Beta Was this translation helpful? Give feedback.
Why not use an action on the element the observer is tied to?