Skip to content

Conversation

marinaaisa
Copy link
Owner

@marinaaisa marinaaisa commented Oct 3, 2025

Bug/issue #161830978, if applicable:

Summary

The order for our routes should be:

  • page routes
  • localized page routes
  • localized fallback routes
  • fallback routes

Before, the order was:

[
    {
        "path": "/tutorials/:id",
        "name": "tutorials-overview"
    },
    {
        "path": "/tutorials/:id/*",
        "name": "topic"
    },
    {
        "path": "/documentation*",
        "name": "documentation-topic"
    },
    {
        "path": "*",
        "name": "not-found",
        "component": {...}
    },
    {
        "path": "*",
        "name": "server-error",
        "component": {...}
    },
    {
        "path": "/:locale?/tutorials/:id",
        "name": "tutorials-overview-locale"
    },
    {
        "path": "/:locale?/tutorials/:id/*",
        "name": "topic-locale"
    },
    {
        "path": "/:locale?/documentation*",
        "name": "documentation-topic-locale"
    }
]

now it is:

[
    {
        "path": "/tutorials/:id",
        "name": "tutorials-overview"
    },
    {
        "path": "/tutorials/:id/*",
        "name": "topic"
    },
    {
        "path": "/documentation*",
        "name": "documentation-topic"
    },
    {
        "path": "/:locale?/tutorials/:id",
        "name": "tutorials-overview-locale"
    },
    {
        "path": "/:locale?/tutorials/:id/*",
        "name": "topic-locale"
    },
    {
        "path": "/:locale?/documentation*",
        "name": "documentation-topic-locale"
    },
    {
        "path": "/:locale?/*",
        "name": "not-found-locale",
        "component": {...}
    },
    {
        "path": "/:locale?/*",
        "name": "server-error-locale",
        "component": {...}
    },
    {
        "path": "*",
        "name": "not-found",
        "component": {...}
    },
    {
        "path": "*",
        "name": "server-error",
        "component": {...}
    }
]

Dependencies

swiftlang#970

Testing

Steps:

  1. Make sure that current routes work fine

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran npm test, and it succeeded
  • Updated documentation if necessary

We want to split the routes into fallbackRoutes and pageRoutes to have
more flexibility into how to organize the routes in our app.
The order for our routes should be:
- page routes
- localized page routes
- fallback routes

This is important because otherwise the request for localized routes
will fall into the fallback routes.

Before, the routes were:

[
    {
        "path": "/tutorials/:id",
        "name": "tutorials-overview"
    },
    {
        "path": "/tutorials/:id/*",
        "name": "topic"
    },
    {
        "path": "/documentation*",
        "name": "documentation-topic"
    },
    {
        "path": "*",
        "name": "not-found",
        "component": {...}
    },
    {
        "path": "*",
        "name": "server-error",
        "component": {...}
    },
    {
        "path": "/:locale?/tutorials/:id",
        "name": "tutorials-overview-locale"
    },
    {
        "path": "/:locale?/tutorials/:id/*",
        "name": "topic-locale"
    },
    {
        "path": "/:locale?/documentation*",
        "name": "documentation-topic-locale"
    }
]

Now they are:

[
    {
        "path": "/tutorials/:id",
        "name": "tutorials-overview"
    },
    {
        "path": "/tutorials/:id/*",
        "name": "topic"
    },
    {
        "path": "/documentation*",
        "name": "documentation-topic"
    },
    {
        "path": "/:locale?/tutorials/:id",
        "name": "tutorials-overview-locale"
    },
    {
        "path": "/:locale?/tutorials/:id/*",
        "name": "topic-locale"
    },
    {
        "path": "/:locale?/documentation*",
        "name": "documentation-topic-locale"
    },
    {
        "path": "*",
        "name": "not-found",
        "component": {...}
    },
    {
        "path": "*",
        "name": "server-error",
        "component": {...}
    }
]
Pages like Not Found or Server error pages should also be localized, so
we need to add them into the router's paths.

Before, the routes were:

[
    {
        "path": "/tutorials/:id",
        "name": "tutorials-overview"
    },
    {
        "path": "/tutorials/:id/*",
        "name": "topic"
    },
    {
        "path": "/documentation*",
        "name": "documentation-topic"
    },
    {
        "path": "/:locale?/tutorials/:id",
        "name": "tutorials-overview-locale"
    },
    {
        "path": "/:locale?/tutorials/:id/*",
        "name": "topic-locale"
    },
    {
        "path": "/:locale?/documentation*",
        "name": "documentation-topic-locale"
    },
    {
        "path": "*",
        "name": "not-found",
        "component": {...}
    },
    {
        "path": "*",
        "name": "server-error",
        "component": {...}
    }
]

Now they are:

[
    {
        "path": "/tutorials/:id",
        "name": "tutorials-overview"
    },
    {
        "path": "/tutorials/:id/*",
        "name": "topic"
    },
    {
        "path": "/documentation*",
        "name": "documentation-topic"
    },
    {
        "path": "/:locale?/tutorials/:id",
        "name": "tutorials-overview-locale"
    },
    {
        "path": "/:locale?/tutorials/:id/*",
        "name": "topic-locale"
    },
    {
        "path": "/:locale?/documentation*",
        "name": "documentation-topic-locale"
    },
    {
        "path": "/:locale?/*",
        "name": "not-found-locale",
        "component": {...}
    },
    {
        "path": "/:locale?/*",
        "name": "server-error-locale",
        "component": {...}
    },
    {
        "path": "*",
        "name": "not-found",
        "component": {...}
    },
    {
        "path": "*",
        "name": "server-error",
        "component": {...}
    }
]
@marinaaisa marinaaisa requested a review from mportiz08 October 3, 2025 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant