mefechoel / svelte-navigator

Simple, accessible routing for Svelte
Other
506 stars 39 forks source link

Lazy Loading example does not pass props to component #110

Open NicolasCwy opened 1 year ago

NicolasCwy commented 1 year ago

Describe the bug Lazy loading example does not pass props to lazily loaded component

Route allows for <Route path="/about" component={About} name={"Bob"} /> which passes the prop name to the rendered component, the example for lazy routes does not have the same behaviour

To Reproduce Steps to reproduce the behavior:

  1. Click on the About which shows that props are not passed to the lazyily loaded component (value is undefined) image

  2. Click on About-Eager to show expected behaviour when using routes

  3. Click on About-LazyFix to show expected behaviour and possible fix (pass through props as discussed on svelte society) image

Svelte Repl

Expected behavior Any props that is not meant for route i.e name is passed to the lazily loaded component <LazyRoute path="/about" component={About} name={"Bob"} />