Redirect from splash screen

Hi.
I’m not using root / route so I added a route that redirects from root / to /dashboard

<Router useAuth={useAuth}>
  <Private unauthenticated="login">
    <Set wrap={MainLayout}>
      <Route path="/dashboard" page={DashboardPage} name="dashboard" />
    </Set>
  </Private>
  <Route path="/login" page={LoginPage} name="login" />
  <Route path="/" redirect="/dashboard" />
  <Route notfound page={NotFoundPage} />
</Router>

It works but I’m getting a warning

gen | Warning: 2 duplicate routes have been detected, only the route(s) closest to the top of the file will be used.
gen |  -> Name: "undefined", Path: "/", Page: "undefined"
gen |  -> Name: "undefined", Path: "undefined", Page: "NotFoundPage"


As I understand that happens because redirect route and notfound route both have name property of undefined.

How to redirect from splash screen and not get warnings?

Hi @passer-by thanks for reporting this!

It is just a warning, so the way you’re doing it should be ok, but you are correct in that the TypeScript definition of a Route doesn’t allow you to define redirect as well as name as props. I will discuss with the team and get a fix in.

In theory you should be able to do this:

      <Route path="/" redirect="/dashboard" name="landing" />

But TS will complain!

I will ignore them for now then, thanks!