Svelte routing when logging in

Hi folks, still playing around with using Svelte as the view layer on a test Meteor app, enjoying it very much. I’m just testing a basic login workflow which seems to work in terms of detecting when a user logs in but doesn’t seem to update the routes that is shown when that login takes place. Below is my svelte App code in case any one using Svelte can give me any tips? Thanks!

  import { Tracker } from 'meteor/tracker'
  import { onDestroy } from 'svelte'
  import { Router, Route, navigate } from 'svelte-routing'
  import Login from '/client/views/Login.svelte'
  import Nav from '/client/views/Nav.svelte'
  import Loading from '/client/views/Loading.svelte'
  import Home from '/client/views/Home.svelte'
  import Clients from '/client/views/Clients.svelte'
  import ClientNew from '/client/views/ClientNew.svelte'
  import Client from '/client/views/Client.svelte'

  let loggedIn = false

  const computation = Tracker.autorun(() => {
    loggedIn = !!Meteor.user()

  onDestroy(() => computation.stop())


<Router url="">
  <div class="container">
    {#if loggedIn}
      <Nav />
      <Route path="/" component={Home} />
      <Route path="/loading" component={Loading} />
      <Route path="/clients" component={Clients} />
      <Route path="/clients/new" component={ClientNew} />
      <Route path="/clients/:id" let:params><Client id={} /></Route>
      <Login />
1 Like