Skip to content

Conversation

@frenzzy
Copy link
Member

@frenzzy frenzzy commented Jun 22, 2021

Option uniqueRouteNameSep allows using non-unique route names among different branches of nested routes.
The router will automatically generate unique names based on parent routes using the specified separator:

const router = new UniversalRouter([
  { name: 'users', path: '/users', children: [{ name: 'list', path: '/list' }] },
  { name: 'pages', path: '/pages', children: [{ name: 'list', path: '/list' }] },
])
const url = generateUrls(router, { uniqueRouteNameSep: '.' })
url('users.list')                     // => /users/list
url('pages.list')                     // => /pages/list

Closes #193

@frenzzy frenzzy mentioned this pull request Jun 22, 2021
3 tasks
@joezappie
Copy link

joezappie commented Jun 23, 2021

Just got a chance to play with this and from what I can tell it works great. I'll definitely be testing it more in depth in the coming week but from my initial tests I've found no issues.

Only thing I found was in the code you use "uniqueRouteNameSep" and in your example above you used "uniqueNameSep". Either of these sound good to me.

Is the preferred method of donation through your open collective link? Really appreciate you adding this in for me and in such little time too!

@frenzzy frenzzy force-pushed the unique-route-names branch from ce8e320 to 57cb5bf Compare June 23, 2021 14:46
@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (main@518e360). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##             main      #194   +/-   ##
========================================
  Coverage        ?   100.00%           
========================================
  Files           ?         3           
  Lines           ?       229           
  Branches        ?        66           
========================================
  Hits            ?       229           
  Misses          ?         0           
  Partials        ?         0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 518e360...57cb5bf. Read the comment docs.

@frenzzy frenzzy force-pushed the main branch 2 times, most recently from 43f68b9 to 185ea69 Compare June 23, 2021 15:01
@frenzzy frenzzy force-pushed the unique-route-names branch from 57cb5bf to 97fa787 Compare June 23, 2021 15:04
@frenzzy frenzzy merged commit 77837b8 into kriasoft:main Jun 23, 2021
@frenzzy frenzzy deleted the unique-route-names branch June 23, 2021 15:07
@frenzzy
Copy link
Member Author

frenzzy commented Jun 23, 2021

@jrj2211 thanks for the review, fixed. Sponsor link should work and yes, open collective is the only way of receiving donations we have at the moment.

Released under v9.1.0 🎉

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nested url generation

3 participants