Skip to content

search part of location is misinterpreted as fragment when root is not "/" #55

Open
@dhritzkiv

Description

@dhritzkiv

When root isn't set to "/", I've noticed some unexpected behaviour with regard to the root url when it has a query string.

An example:

const Router = AmpersandRouter.extend({
    routes: {
        "": "index",
        "(*path)": "catchAll"
    },
    index() {
        //never fires
    },
    catchAll(path, query) {
        console.log(pathname);//path results in the query string instead
    }
});

const router = new Router();

router.history.start({
    pushState: true,
    root: "/app"
});

When starting the page at, say /app?foo=bar, path incorrectly results in "foo=bar", which isn't right. router.history.fragment also reports "foo=bar".

However, staring the page at /app/second?foo=bar, path correctly results in "/second"

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions