Skip to content

Configured route redirect does not propagate query string #667

@rmja

Description

@rmja

I'm submitting a bug report

  • Library Version:
    1.5.0

Please tell us about your environment:

  • Operating System:
    Windows 10

  • Node Version:
    14.6.0

  • NPM Version:
    6.14.8
  • JSPM OR Webpack AND Version
    webpack 4
  • Browser:
    all

  • Language:
    all

Current behavior:
The following route configuration does not propagate the query string to the redirected route:

const routes: RouteConfig[] = [
    { route: "does-not-work", redirect: "/dashboard?autoselect=true"; },
    { route: "does-work", navigationStrategy: instruction => { instruction.config.redirect = "/dashboard"; instruction.queryString = "autoselect=true"; } },
    { route: "dashboard", name: "dashboard", moduleId: PLATFORM.moduleName("./dashboard")  }
];

Expected/desired behavior:

  • What is the expected behavior?
    The route "does-not-work" should have the behavior of "does-work".
    The issue is related to this code:

let queryString = instruction.queryString;
if (queryString) {
redirectLocation += '?' + queryString;
}

I believe the behavior should be more like instruction.queryString || redirectInstruction.queryString

  • What is the motivation / use case for changing the behavior?
    Easier configuration of redirect route

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions