Routing from within a sub component

This issue has been tracked since 2021-03-22.

I have been trying to navigate to a new page from within a component. However, the page does not load properly, the component containing the link is simply replaced with content of the correct page but other items that should be removed remain on the page.

If there is a correct way to route back via to the primary router it would be maybe good to see in the examples.

Following this example when I hit the link to PageX, component A is replaced by PageX but component B is not removed unless I hit refresh and the routing works correctly.

--Home.Svelte
<A />
<B />

--A.Svelte
...
<Link to="/PageX">Some  Content</Link>
...
CraigChamberlain wrote this answer on 2021-03-23

Does a link need to be inside a router in the sub-component or is it enough for it to be nested inside the master router?

CraigChamberlain wrote this answer on 2021-03-23

This is actually a problem with the Carousel failing on removal which then stops the rest of the page being processed. Is there a way to make this more fault tollerent?

index.mjs:199 Uncaught (in promise) TypeError: Cannot read property 'removeChild' of null
at detach (index.mjs:199)
at detach_dev (index.mjs:1592)
at Object.destroy [as d] (Carousel.svelte:68)
at Object.destroy [as d] (Carousel.svelte:14)
at destroy_component (index.mjs:1434)
at Object.destroy [as d] (Carousel.svelte:64)
at Object.destroy [as d] (Carousel.svelte:63)
at Object.destroy [as d] (utils.js:331)
at destroy_component (index.mjs:1434)
at Object.destroy [as d] (Carousel.svelte:63)


CraigChamberlain wrote this answer on 2021-03-23

Simply wrapping Carousel with a div sorted the problem which appears to have nothing to do with this package.

beyonk-adventures/svelte-carousel#35

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

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date