Skip to content

Cannot read property 'name' of undefined when trying to set queryParams in beforeModel #17118

Open
@ohcibi

Description

@ohcibi

I'm getting the error TypeError: Cannot read property 'name' of undefined when trying to this.transitionTo({ queryParams: { somParam: 'someValue' } }) in this very line:

let leafRouteName = routeInfos[handlerInfoLength - 1].name;

I debugged it and it appears that routeInfos is an empty array and therefore that line must throw naturally. As I am unable to reproduce it in a twiddle and have no clue how to debug this further, I'd like to know what an empty routeInfos array actually means here and if this is an error after all or rather a bug? When looking at my app, it works as expected, i.e. the query parameter does get set and the URL in the browser is updated accordingly. So this is not an issue about the query parameter not being set.

For the matter of this issue, I'd say a check if that array is empty and a better error message should be added. I can't PR this as I don't understand the internals here, otherwise I would.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions