Replaced component not getting destroyed if children are still loading

This issue has been tracked since 2021-02-14.

I'm running into an intermittent bug (dependent on internet performance, sadly), and it's probably something I'm doing wrong, but I'm not sure where to hook into svelte-routing to see where the problem is occurring.

I have a fairly simple router setup for a photo viewer like so:

<Router url={url}>
        <Route path="album/:albumSlug/:photoID" component={PhotoPage} />
        <Route path="album/:albumSlug" component={Album} />
        <Route path="/" component={AlbumList} />

When I'm on an album/:albumSlug page and navigate back to /, usually everything goes fine, unless the internet is being cranky, in which case the AlbumList component gets mounted next to the Album. The URL changes appropriately, so a refresh fixes it, but I can't figure out why the Album component is sticking around. (Its onDestroy is never getting called.)

The only thing I can think of is that the images in the Album component each have a listener for their load events, so maybe until those have fired, the destruction is getting held up? That doesn't seem right...

In any case, it's probably something wrong with my usage of Svelte or svelte-routing, but was wondering if you had a thought on where I could start poking to figure it out. Thanks for any help you can offer.

phenomeno wrote this answer on 2021-03-10

Do you have transitions anywhere? My problem resolved when I set them to be local. The discussion in this issue helped: #107

sjml wrote this answer on 2021-03-10

That was indeed the problem! I eventually figured it out after switching to another routing library and back, so I forgot I even opened this issue.

Thanks for the prompt; I never would have thought to look at child transitions as the source of the problem. Hopefully this issue can help someone else down the line.

More Details About Repo
Owner Name EmilTholin
Repo Name svelte-routing
Full Name EmilTholin/svelte-routing
Language JavaScript
Created Date 2017-11-28
Updated Date 2022-12-03
Star Count 1711
Watcher Count 21
Fork Count 151
Issue Count 59


Issue Title Created Date Updated Date