question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Promise and lazy routes...

See original GitHub issue

Amazing router! Congratulations!

Looking at yrv router (a good router!) we can see two ways of importing routes:

<Router>
  <Route exact path="/promise" component={import('path/to/other-component.svelte')}/>
  <Route exact path="/lazy" component={() => import('path/to/another-component.svelte')}/>
</Router>

The promise way I think is amazing because I can have a lot of routes and maybe I just need to load immediately just the one I need and after that in background start downloading others.

Can we do the same with tinro?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
AlexxNBcommented, Apr 23, 2020

Thanks =) I’ll look for a way of minimal implementation of this. Module size is priority.

1reaction
AlexxNBcommented, Apr 28, 2020

Little change in Lazyloader.svelte: Replace {#await cmp()} by {#await cmp.then ? cmp : cmp()} and you will be able to use either import or functions as cmp property.

Just load imports in variables in root file if you want to do preloading. Then use this variables for cmp property. Or just use <Lazylaoder cmp={import('./Something.svelte')}/> and components will be downloaded when current component will be mounted.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Promise and lazy routes... · Issue #104 · ItalyPaleAle/svelte ...
Not bad but I think svelte-spa-router needs something internal, three-shackable, both promising and lazying , with pending prop (or something else to indicate...
Read more >
Uncaught (in promise): Error: Cannot match any routes. URL ...
I am trying to lazy load the orders module which has two components orders and test. The orders route is working fine but...
Read more >
Lazy Loading Routes | Vue Router
Lazy Loading Routes # ... When building apps with a bundler, the JavaScript bundle can become quite large, and thus affect the page...
Read more >
How To Use Lazy Loading Routes in Angular | DigitalOcean
In this article, you will use lazy loading routes in an Angular ... The dynamic import is promise-based and gives you access to...
Read more >
Lazy Loading Routes using an Observable with the Angular ...
The snippet above uses the loadChildren property in the Route object to lazy load the route using a Promise. This API is defined...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found