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

fix: trailingSlash and child routes not working #8423

Merged
merged 12 commits into from
Dec 17, 2020
Merged

fix: trailingSlash and child routes not working #8423

merged 12 commits into from
Dec 17, 2020

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Dec 1, 2020

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Resolves #8422 also adding dev test for 3 possible values of trailing slash

[vue-router] Named Route 'posts' has a default child route. When navigating to this named route (:to="{name: 'posts'"), the default child route will not be rendered. Remove the name from this route and use the name of the default child route for named links instead.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly. (PR: #)
  • I have added tests to cover my changes (if not applicable, please state why)
  • All new and existing tests are passing.

Sorry, something went wrong.

@pi0 pi0 changed the base branch from dev to 2.x December 1, 2020 15:18

Verified

This commit was signed with the committer’s verified signature.
danielroe Daniel Roe

Verified

This commit was signed with the committer’s verified signature.
danielroe Daniel Roe
@pi0 pi0 marked this pull request as ready for review December 1, 2020 15:36
@rchl
Copy link

rchl commented Dec 1, 2020

Maybe you could also add trailingSlash=false version of that testsuite? I guess we don't have any existing testing for it?

@pi0
Copy link
Member Author

pi0 commented Dec 1, 2020

@rchl
Copy link

rchl commented Dec 1, 2020

trailingSlash=undefined and trailingSlash=false are not handled the same though.

farnabaz
farnabaz previously approved these changes Dec 1, 2020
pi0 added 2 commits December 1, 2020 17:56

Verified

This commit was signed with the committer’s verified signature.
danielroe Daniel Roe

Verified

This commit was signed with the committer’s verified signature.
danielroe Daniel Roe
@pi0
Copy link
Member Author

pi0 commented Dec 1, 2020

@rchl There is also a unit/snapshot test for routes utility: https://github.com/nuxt/nuxt.js/blob/dev/packages/utils/test/route.test.js

@rchl
Copy link

rchl commented Dec 1, 2020

@rchl There is also a unit/snapshot test for routes utility: https://github.com/nuxt/nuxt.js/blob/dev/packages/utils/test/route.test.js

I don't see it testing the trailingSlash: false case which, as I've said, is not entirely identical to it being undefined.

@pi0
Copy link
Member Author

pi0 commented Dec 1, 2020

Actually it is :) Anyway agreed that snapshot couldn't cover this issue so added trailing-slash-false dev tests :) (Update: added test for all 3 variants of undefined/false/true)

@danielroe
Copy link
Member

I think we should pair this PR with another one for the docs to explain what the behaviour should be as I think there are a variety of different expectations in the related issues...

Happy to pick that up.

@codecov-io
Copy link

codecov-io commented Dec 1, 2020

Codecov Report

Merging #8423 (5596200) into dev (5318172) will decrease coverage by 0.30%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #8423      +/-   ##
==========================================
- Coverage   67.93%   67.62%   -0.31%     
==========================================
  Files          91       91              
  Lines        3920     3917       -3     
  Branches     1071     1070       -1     
==========================================
- Hits         2663     2649      -14     
- Misses       1017     1024       +7     
- Partials      240      244       +4     
Flag Coverage Δ
unittests 67.62% <0.00%> (-0.31%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/utils/src/route.js 86.25% <0.00%> (-7.01%) ⬇️

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 5318172...5596200. Read the comment docs.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@pi0 pi0 changed the base branch from 2.x to dev December 17, 2020 12:32
@pi0 pi0 dismissed farnabaz’s stale review December 17, 2020 12:32

The base branch was changed.

pi0 added 4 commits December 17, 2020 13:32

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
modification scenario is wrong. not only because rootDir can contain other projects that build parallel, but also modules may generate a file outside
@pi0 pi0 merged commit b06df71 into dev Dec 17, 2020
@pi0 pi0 deleted the fix/child-trailing branch December 17, 2020 13:34
@pi0 pi0 mentioned this pull request Jan 4, 2021
pi0 pushed a commit to nuxt/website-v2 that referenced this pull request Jul 8, 2021
imgbot bot pushed a commit to nuxt/website-v2 that referenced this pull request Jan 10, 2023
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

trailingSlash=true and child routes generates a VueRouter warning
5 participants