-
Notifications
You must be signed in to change notification settings - Fork 294
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
v5: NextJS improvements #2691
v5: NextJS improvements #2691
Conversation
🦋 Changeset detectedLatest commit: 4cf05ac The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
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 |
bfc06d1
to
8f74ed3
Compare
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.
This looks good to me, Is this still WIP ?
// TODO @nikos: we need to make this more generic | ||
// and move the logic in clerk/backend |
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.
Are you referring to a possible helper named copyHeaders
?
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.
Yes, but also extracting this to clerk/backend
No :) please review it! |
c97c276
to
bcab882
Compare
@@ -1,6 +1,6 @@ | |||
import { errorThrower, parsePublishableKey } from './util/shared'; | |||
|
|||
const buildUrl = (_baseUrl: string | URL, _targetUrl: string | URL, _returnBackUrl?: string | URL) => { | |||
const buildUrl = (_baseUrl: string | URL, _targetUrl: string | URL, _returnBackUrl?: string | URL | null) => { |
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.
❓ why did we prefix all the params with _
? I thought we prefix a variable with an underscore to mark it as ignored which is not the case here. Should we rename the params in another PR?
signInUrl: SIGN_IN_URL, | ||
signUpUrl: SIGN_UP_URL, | ||
}).redirectToSignIn; | ||
const clerkUrl = getAuthKeyFromRequest(request, 'ClerkUrl') as AuthStatus; |
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.
☁️ clerkUrl
is of type AuthStatus
? Is this some kind of typo? Also getAuthKeyFromRequest
returns string | null | undefined
, so the clerkUrl
many not have a .toString()
method.
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.
Good catch @dimkl
TS did not complain as AuthStatus overlaps with string. Let me fix it!
bcab882
to
1fbd905
Compare
…directToSignIn internally
1fbd905
to
4cf05ac
Compare
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.
💯
Description
The
auth().redirectToSignIn()
helper no longer needs to be explicitly returned when called within the middleware. The following examples are now equivalent:Calling
auth().protect()
from a page will now automatically redirect back to the same page by settingredirect_url
to the request url before the redirect to the sign-in URL takes place.Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change
Packages affected
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/clerk-expo
@clerk/fastify
gatsby-plugin-clerk
@clerk/localizations
@clerk/nextjs
@clerk/clerk-react
@clerk/remix
@clerk/clerk-sdk-node
@clerk/shared
@clerk/themes
@clerk/types
build/tooling/chore