When im using svelte-kits routing system, I can create dynamics pages using [page].svelte
for example, that will be rendered when I'm calling localhost:3000/foo
. However when I'm navigating from localhost:3000/foo
to localhost:3000/bar
, the onMount()
function is not called (I guess for performance reasons).
I can work around this issue by wrapping all relevant stuff in a {#key ... }
expression, but is there any way to "remount" the page?
Thenks for helping me out :)
page
changes, you can put all these actions inside a function and call that function whenpage
updates with a reactive statement that is dependent onpage
, for example:$: doRefresh(page)
. - Thomas Hennescanvas
element was not fully removed, leading to performance issues. There it seemed easier to just fully 'remount' the page. - derschiw{#key}
would indeed be the right choice. - Thomas Hennes