-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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: Paginate adds unexpected trailing slash on index route #6676
Conversation
🦋 Changeset detectedLatest commit: b7a4051 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Will resolve that failed unit test tomorrow! Looks like we expect a |
8228394
to
56099c1
Compare
if (color === 'blue' && p === 1) { | ||
expect(prevHref).to.be.undefined; | ||
expect(nextHref).to.equal('/posts/blue/2'); | ||
} | ||
if (color === 'blue' && p === 2) { | ||
expect(prevHref).to.equal('/posts/blue/1'); | ||
expect(nextHref).to.be.undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these tests every run? Say when p = '1'
===> p === 1
is false
which will cause the test to not run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this is a super imperative way to check if the params
entry matches one of the items in the list (see the lines just above). Brain-dead solution I know, but oddly the simplest I could find 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant that p
is always a string so comparing it to the numbers will return false
'1' !=== 1
I'm I overlooking something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhhh right you are! I'm a fool. Will fix
Co-authored-by: Happydev <81974850+MoustaphaDev@users.noreply.github.com>
…/astro into fix/paginate-build-format-file
Changes
paginate
create brokenpage.url.prev
link for second page (added trailing slash) #6603undefined
for index routes during pagination. Otherwise, this inserts an expected trailing/
. found this also generates/posts//
by default!Testing
Docs
N/A