vue-routisan icon indicating copy to clipboard operation
vue-routisan copied to clipboard

[2.x] Route grouping without prefix create wrong routes

Open waltergalvao opened this issue 6 years ago • 3 comments

What version of vue-routisan are you using?

2.1.0

Provide a short but clear description of the bug.

Currently, you're obliging groups to have a prefix. If I don't specify one, routes inside will get a double slash.

Expected behavior

We should be able to group routes only for the beforeEnter functionality.

Actual behavior

We can't group routes without specifying a prefix, otherwise it will get a dev.localhost/route//double-slashed.

Reproduction link

https://codesandbox.io/s/m5rv397zk9

You'll be able to see the routes on browser console

Possible QuickFix

I changed the groupMerge function from util.js to

export const groupMerge = ($new, $old) => {
    let prefix = mergePrefix($new, $old);

    if (!prefix) {
      return {
        beforeEnter: mergeGuard($new, $old)
      }
    }

    return {
        beforeEnter: mergeGuard($new, $old),
        prefix: prefix
    };
};

It worked, but I guess that's now how you want to deal with this problem hehe.

waltergalvao avatar Dec 05 '18 18:12 waltergalvao

@raniesantos

waltergalvao avatar Dec 11 '18 13:12 waltergalvao

@wbgneto I've taken over the project and have already begun work on v3, which will cover this issue. Will leave this open until v3 is released.

mikerockett avatar Feb 22 '20 19:02 mikerockett

@wbgneto – Routisan 3 Alpha has been released. I've gone ahead and forked your sandbox, showing that the issue is now resolved: https://codesandbox.io/s/vue-routisan-47-fixed-in-v3-gtxiu?file=/src/main.js

If you’d like to give it a try in a project:

$ npm i vue-routisan@next

Docs: https://vue-routisan.rockett.pw/

Going to keep this issue open until such time as v3 stable is released.

mikerockett avatar Aug 16 '20 09:08 mikerockett