Skip to content

fallback route if all routes including nested ones failed to match #264

@jsprog

Description

@jsprog

This should've went into the Discussions tab if it was available.

I'm trying to achieve the following:

  • app with multiple layouts (Layout Route + Layout Router per layout).
  • Layout Route should fail to match if all the nested routes failed to match.

unfortunately, no way to reach Not Found.

<script>
    import {Router, Route} from 'svelte-routing'
</script>

<Router>
    <Route path="/*">
        <div>Main Layout</div>
        <Router>
            <Route path="/">Main</Route>
            <Route path="/nested">nested within main layout</Route>
        </Router>
    </Route>

    <Route path="/config/*">
        <div>Config Layout</div>
        <Router>
            <Route path="/">Config Listing</Route>
            <Route path="/1">Config 1</Route>
            <Route path="/2">Config 2</Route>
        </Router>
    </Route>

    <Route path="*">Not Found</Route>
</Router>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions