Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] wrong condition of current.matched in src/util/location.js#27 #1169

Closed
puxxustc opened this issue Feb 16, 2017 · 6 comments
Closed

[bug] wrong condition of current.matched in src/util/location.js#27 #1169

puxxustc opened this issue Feb 16, 2017 · 6 comments

Comments

@puxxustc
Copy link

This line https://github.com/vuejs/vue-router/blob/dev/src/util/location.js#L27

    } else if (current.matched) {

current.matched is an Array, so this condition should be

    } else if (current.matched.length === 0) {
@fnlctrl
Copy link
Member

fnlctrl commented Feb 16, 2017

It's perfectly fine to put an array inside if, to check for its existence.

@fnlctrl fnlctrl closed this as completed Feb 16, 2017
@puxxustc
Copy link
Author

current.matched can be []

@fnlctrl
Copy link
Member

fnlctrl commented Feb 16, 2017

It's guaranteed to be not emtpy. Please provide an actual reproduction if you believe there's a bug.

@posva
Copy link
Member

posva commented Feb 16, 2017

@fnlctrl There's probably something wrong with that check, it may be unnecessary because in the flow types it's always an array, it cannot be absent. So we're probably missing a little improvement either in the types or in the codition there

@puxxustc
Copy link
Author

Here is a stacktrace recorded by sentry:

vue@2.1.10, vue-loader@11.0.0, vue-router@2.2.1, vuex@2.1.2, vuex-router-sync@4.1.2, webpack@2.2.1

image

@fnlctrl
Copy link
Member

fnlctrl commented Feb 17, 2017

Again, please provide a reproduction, thanks!

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

No branches or pull requests

3 participants