feat(clerk-react): Replace signOutCallback with redirectUrl in SignOutButton#2348
Conversation
🦋 Changeset detectedLatest commit: 9cf0f8c 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 |
signOutCallback with redirectUrl in SignOutButton
| export const SignOutButton = withClerk( | ||
| ({ clerk, children, ...props }: React.PropsWithChildren<WithClerkProp<SignOutButtonProps>>) => { | ||
| const { signOutCallback, signOutOptions, ...rest } = props; | ||
| const { redirectUrl = '/', signOutOptions, ...rest } = props; |
There was a problem hiding this comment.
Open to suggestions to moving this default to somewhere else (if necessary)
There was a problem hiding this comment.
🤔 I would suggest we open a ticket and move all the defaults (we have defaults for afterSignInUrl, afterSingUpUrl) to a separate module to have all the default settings in a centralized place. For now, it seems fine to leave it there.
| export const SignOutButton = withClerk( | ||
| ({ clerk, children, ...props }: React.PropsWithChildren<WithClerkProp<SignOutButtonProps>>) => { | ||
| const { signOutCallback, signOutOptions, ...rest } = props; | ||
| const { redirectUrl = '/', signOutOptions, ...rest } = props; |
There was a problem hiding this comment.
🤔 I would suggest we open a ticket and move all the defaults (we have defaults for afterSignInUrl, afterSingUpUrl) to a separate module to have all the default settings in a centralized place. For now, it seems fine to leave it there.
Description
Replace the
signOutCallbackprop on the<SignOutButton />withredirectUrl. This aligns the API surface with other UI components provided by@clerk/clerk-react.If you previously used the
signOutCallbackprop to navigate to another page, you can migrate as shown below.Before:
After:
Related to #1981 which uncovered a bug. With the
redirectUrlpeople could more easily (and aligned with our other APIs) decide where to redirect.Checklist
npm testruns as expected.npm run buildruns as expected.Type of change
Packages affected
@clerk/backend@clerk/chrome-extension@clerk/clerk-js@clerk/clerk-expo@clerk/fastifygatsby-plugin-clerk@clerk/localizations@clerk/nextjs@clerk/clerk-react@clerk/remix@clerk/clerk-sdk-node@clerk/shared@clerk/themes@clerk/typesbuild/tooling/chore