hfhbd / routing-compose

Routing feature for Compose Web, Compose HTML and Desktop
https://routing.softwork.app/
Apache License 2.0
138 stars 14 forks source link

Nested routing issue #373

Closed TomislavMladenov closed 4 months ago

TomislavMladenov commented 4 months ago

I love the library and it's simplicity, however I can't make the nested routing work for some reason.

I am using simple routing:

BrowserRouter(initPath = "/") {
    route("/") {
        Text("This is default route")
    }
    route("/user") {
         string {
             Text("This is user route with uuid: $it")
          }
     }
     route("/grades") {
         Text("This is grades route")
     }
}

The routes with baseUrl/user and baseUrl/grades are working. If I try something like baseUrl/user/someRandomId I see only blank screen.

Included the devServcerConfig.js not sure what is wrong.

If I use navigate function it works. For example: router.navigate(user/someRandomId) it works. If I try to enter it in the browser it's not working, simply empty page, even the noMatch component is not shown.

The issue would be if the user open a link, scan QR code etc.

Any help would be very appreciated.

TomislavMladenov commented 4 months ago

Okay the problem was in the Webpack and how it handles the "Catch-all-strategy". Apparently "allowedHosts": "all", / was not enough I also needed to use <base href="/"/> or output path to "/" in the config.