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!

I have a similar question and would love to get some feedback on the optimal approach, and how I should set things up from a redwood perspective. Thank you in advance.

Context

I have two applications hosted on two different domain names:

  • Application 1 (a1) hosted on domain 1 (d1 a .com tld)
  • Application 2 (a2) hosted on domain 2 (d2 a .gg tld)
  • a1 is a marketing app and a2 is a user profile app

a1 Marketing App

The marketing site on d1 is set-up as follows:

  • Marketing Splash page on the home page
  • Marketing About page at d1/about
  • Marketing Blog at d1/blog
  • Etc.

a2 User Profiles App

User profiles are hosted on d2 as follows:

  • d2/userhandle, where each user has a unique userhandle
  • d2 does not have a Splash/Home page, About page, or Blog page or any other page that could conflict with d1

Requirements

  • When a user visits d2 home/index route, I want the content on d1 (the Splash page) to be shown but for the webaddress to show as d2 (i.e. d1 masked)
  • When a user visits d2/about, I want the content on d1/about to be shown but for the webaddress to show as d2/about
  • When a user visits d2/blog, I want the content on d1/blog to be shown but for the webaddress to show as d2/blog
  • Etc.

I have a couple of questions about this:

  1. Is this a good idea? Main motivation is that I want to separate the marketing and user applications.
  2. How should I go about setting this up in redwood. Anything specific I need to consider other than domain redirects?