TehShrike / abstract-state-router

Like ui-router, but without all the Angular. The best way to structure a single-page webapp.

Home Page:http://tehshrike.github.io/state-router-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Push state routing not working with "defaultChild state with an empty route string"

sw-clough opened this issue · comments

As per title, I cannot get the following scenario to work.

stateRouter.addState({
    name: "app.foo",
    route: "/foo/",
    template: {},
    defaultChild: "view"
})
stateRouter.addState({
    name: "app.foo.view",
    route: "",
    template: {},
})
stateRouter.addState({
    name: "app.foo.edit",
    route: "edit",
    template: {},
})

When I am on a page that has a link asr.go("app.foo"), the url correctly shows as /foo/, but the browser goes to /foo, and nothing renders. If I manually change the url to /foo/, it renders. I have tried removing the / from app.foo, and tried adding it to app.foo.view too.

The edit state works in all instances. Changing the route for app.foo.view to eg view works too.

I am using svelte-state-renderer with embedded components, but I do no think this is the issue, because your demo implementation handles this scenario successfully (without push state routing). So I think the problem must be in ASR.

I found the issue, it was in the sausage-router package. I will make an issue there.