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

feat(clerk-js): Change the default behaviour of afterSignOutUrl, afterSignIn and afterSignUp #2020

Conversation

octoper
Copy link
Member

@octoper octoper commented Nov 2, 2023

Description

This PR changes the default behaviour of the following

  • Change the default behaviour of after afterSignOutUrl prop in <UserButton /> to be redirected to / instead of the Account Portal defined url.
  • Change the default behaviour of after afterSignIn and afterSignUp props to be redirected to / instead of the Account Portal defined url.
  • Use the default options for the Clerk singleton as right now they get overwritten from undefined values.
  • Added a utility function to @clerk/shared package, that receives an object and returns it back without the properties undefined value.

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

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

@octoper octoper requested a review from a team as a code owner November 2, 2023 21:08
Copy link

changeset-bot bot commented Nov 2, 2023

🦋 Changeset detected

Latest commit: 59ab8ae

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@clerk/clerk-js Major
@clerk/shared Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch
@clerk/backend Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch
gatsby-plugin-clerk Patch

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

@octoper octoper force-pushed the vaggelis/sdk-831-change-the-default-behavior-of-aftersignouturl-of-userbutton branch from 2e81ce1 to 91fe24d Compare November 2, 2023 21:08
@octoper octoper changed the title feat(clerk-js): Change the default behavior of afterSignOutUrl, afterSignIn and afterSignUp feat(clerk-js): Change the default behaviour of afterSignOutUrl, afterSignIn and afterSignUp Nov 2, 2023
Comment on lines 143 to 134
afterSignInUrl: '/',
afterSignUpUrl: '/',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are more places in our codebase where we use displayConfig.afterSignInUrl and displayConfig.afterSignUpUrl. Are those also considered?

Copy link
Member Author

@octoper octoper Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the changes I made the default values will be directly taken from the defaultOptions so the displayConfig.afterSignInUrl or displayConfig.afterSignUpUrl are never used.

@dimkl dimkl force-pushed the vaggelis/sdk-831-change-the-default-behavior-of-aftersignouturl-of-userbutton branch from 7aecc46 to eae95f2 Compare November 6, 2023 11:29
@octoper octoper force-pushed the vaggelis/sdk-831-change-the-default-behavior-of-aftersignouturl-of-userbutton branch 2 times, most recently from 35db2db to 0ffd8bf Compare November 7, 2023 11:02
@octoper octoper force-pushed the vaggelis/sdk-831-change-the-default-behavior-of-aftersignouturl-of-userbutton branch 2 times, most recently from 42e46a1 to 320b770 Compare November 8, 2023 11:05
Copy link
Member

@nikosdouvlis nikosdouvlis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@octoper You will need to apply the changes to the ui-retheme dir. I will share more details within the day

@octoper octoper force-pushed the vaggelis/sdk-831-change-the-default-behavior-of-aftersignouturl-of-userbutton branch 2 times, most recently from 74cc3f8 to 9997c00 Compare November 10, 2023 10:02
@octoper octoper force-pushed the vaggelis/sdk-831-change-the-default-behavior-of-aftersignouturl-of-userbutton branch 3 times, most recently from 5c30f34 to 15b3a32 Compare November 15, 2023 08:47
.changeset/spotty-boxes-do.md Outdated Show resolved Hide resolved
packages/clerk-js/src/core/clerk.redirects.test.ts Outdated Show resolved Hide resolved
@octoper octoper force-pushed the vaggelis/sdk-831-change-the-default-behavior-of-aftersignouturl-of-userbutton branch from af58073 to 021108b Compare November 15, 2023 14:46
Comment on lines 133 to 134
afterSignInUrl: '/',
afterSignUpUrl: '/',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to take another look, but my instinct tells me that this is not the direction we want to go as this will cause these to have actual values so, by default, the URLs will include the query params.

What we want to do instead, is to change the behavior of Clerk IF these are undefined

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the changes to only fallback to / and the values will not be included to the query params.

@octoper octoper force-pushed the vaggelis/sdk-831-change-the-default-behavior-of-aftersignouturl-of-userbutton branch from bf04a09 to 2c10bf3 Compare December 4, 2023 15:34
@octoper octoper force-pushed the vaggelis/sdk-831-change-the-default-behavior-of-aftersignouturl-of-userbutton branch from 2c10bf3 to 59ab8ae Compare December 6, 2023 09:10
@octoper octoper added this pull request to the merge queue Dec 6, 2023
Merged via the queue into main with commit d30ea1f Dec 6, 2023
9 checks passed
@octoper octoper deleted the vaggelis/sdk-831-change-the-default-behavior-of-aftersignouturl-of-userbutton branch December 6, 2023 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants