Skip to content

if router query have null or undefined value, will throw error #1725

Closed
@svkd9

Description

@svkd9

Version

2.7.0

Reproduction link

https://github.com/vuejs/vue-router/blob/v2.7.0/src/util/route.js#L86

Steps to reproduce

const routerQuery = {
a: null,
b: undefined
}
this.$router.push({name: 'routerName', query: routerQuery})

What is expected?

no error

What is actually happening?

throw error 'Cannot convert undefined or null to object'


i think the problem maybe in https://github.com/vuejs/vue-router/blob/v2.7.0/src/util/route.js#L86

typeof aVal === 'object' ====> Object.prototype.toString.call(aVal) === '[object Object]'

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