RedirectRouteProps should support a "name" parameter

There is a fairly common use-case where within a set of routes, there is 1 route that is the default. For example, in the Redwood scaffolding scenario, a good choice for the default route would be the model listing page.

Here is another example. Suppose we have the following Set of routes to perform various types of account settings

<Set private unauthenticated="signin" wrap={AccountSettingLayout}>
   <Route path="/settings/security" page={SecuritySettingsPage} name="securitySettings"/>
   <Route path="/settings/billing" page={BillingSettingsPage} name="billingSettings"/>
   <Route path="/settings/user-profile" page={UserProfileSettingsPage} name="userProfileSettings"/>

A typical usage scenario would be a user clicking on the “cog” icon in the web app’s navbar. That action would take us to the default page of this <Set>, where there is a sidenav leading to the other pages within the set. Let’s say that default page is the userProfileSettings page. If I understand things correctly, we currently have 3 choices in Redwood:

  1. Create a new page and explicitly define it with the <Redirect> component, like this

    const SettingsPage = () => <Redirect to={routes.userProfileSettings()} />.

    This is unnecessary file bloat and not the right place for this information. The default route of a set should be declared with the set.

  2. Rename “userProfileSettings” to “accountSettings” and essentially hardcode this default. This introduces an unnecessary chance for error when we change our mind about the default route.

  3. Create a nameless redirect route

    <Route path="/settings" redirect="/settings-user-profile" />.

    However, without a name, we’d have to hardcode the path in any NavLink that references this route, e.g. the cog icon link.

Imo, the cleaner alternative (with good separation of concerns) to define default route is this within the above Set.

<Route path="/settings/user-profile" name="settings" redirect="/settings/user-profile" />

For this, we need to support the name parameter in RedirectRouteProps. From what I can tell, it seems to be a fairly minor undertaking.