A route autosubscribing to $page.params will be unsubscribed before $page.params is changed to a new route
The autosubscription is being triggered late exactly once, i.e. if I navigate from channels/[slug].svelte to games/[slug].svelte, the Channel route's subscription will be triggered exactly once with the slug param for the Game route
I'm facing the same issue, I also tried to unsubscribe in onDestroy hook but it's trigger too late. Have you find a workaround ? Actualy, I compare route path to prevent function :
const path = $page.path;
const pageUnsubscribe = page.subscribe((p) => {
if (p.path !== path) {
return;
}
const min = new Date(p.query.date);
const max = new Date(p.query.date);
min.setUTCHours(0, 0, 0, 0);
max.setUTCHours(23, 59, 59, 999);
store.search(min, max);
});
But i'm not a big fan :smile:
This has been fixed in 0.27.13, thank you @pchynoweth!
Most helpful comment
I'm facing the same issue, I also tried to unsubscribe in
onDestroyhook but it's trigger too late. Have you find a workaround ? Actualy, I compare route path to prevent function :But i'm not a big fan :smile: