Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation events #121

Closed
maximedupre opened this issue Mar 20, 2020 · 3 comments
Closed

Navigation events #121

maximedupre opened this issue Mar 20, 2020 · 3 comments

Comments

@maximedupre
Copy link

maximedupre commented Mar 20, 2020

When navigating to one of my routes, there is a noticeable delay before the component is displayed. Does svelte-routing provide any event that would allow me to show and hide a progress bar (when the navigation starts and ends)?

On the same note, I think there should be some option that would allow for the component to be loaded only once, then toggled when the route changes, in order to avoid loading the whole component trees.

Cheers!

EDIT # 1

I guess the delay has to do with the fact that components are loaded synchronously, thus blocking the page if there is some processing. Am I right to think that the only solution is to lazy-load component with something like svelte-loadable?

EDIT # 2

Using svelte-loadable does not seem to help. It's pretty weird that my component loads quickly when loading the page initially. Only once it is loaded via svelte-routing, because a route has been activated ,is there a ~1 second delay before my component is shown.

@EmilTholin
Copy link
Owner

Hi @maximedupre!

Do you have a minimal reproducible example that we could ideally clone and try out? There should not be any delay when navigating since the component code is already loaded by your browser and ready to be rendered straight away.

@EmilTholin
Copy link
Owner

Closing this as I can't reproduce it. Feel free to re-open or comment with a minimal reproducible example if the problem persists.

@mpro7
Copy link

mpro7 commented May 28, 2021

@EmilTholin is there any event fired on the route change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants