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

push to named star route with empty pathMatch fails #3106

Comments

@adi-zz
Copy link
Contributor

adi-zz commented Jan 19, 2020

Version

3.1.3

Reproduction link

https://codesandbox.io/s/vue-template-7k3sv

Steps to reproduce

  1. Open https://codesandbox.io/s/vue-template-7k3sv
  2. Click [button 1]. Note you get to https://7k3sv.csb.app/anything/123 - which is ok.
  3. Click [button 2].

What is expected?

You should get to https://7k3sv.csb.app/anything/.

What is actually happening?

You get to https://7k3sv.csb.app/.


I checked a couple of vue-router issues in the past, and I noticed posva has his own particular way of assessing bugs, so I know he will say this is not a bug. But is there anyone in vue-router team willing to acknowledge this is a bug? (cc @yyx990803, @kazupon)

I used the latest vue-router available on npm (3.1.5). My current issue report says I used 3.1.3 because new-issue.vuejs.org does not let me choose 3.1.5. Guys, if you force me using new-issue.vuejs.org when reporting an issue, it would be nice to keep it up-to-date.

@posva
Copy link
Member

posva commented Jan 19, 2020

The workaround for this is using a named param with a custom regexp, which will be the preferred way in the next major version:

{
      name: "catchAllRoute",
      path: "/anything/:pathMatch(.*)"
    }

@posva posva changed the title router.push with a "location descriptor object" does not work push to named star route with empty pathMatch fails Jan 19, 2020
adi-zz added a commit to adi-zz/vue-router that referenced this issue Jan 21, 2020
@posva posva closed this as completed in 38e6ccd Jan 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment