Skip to content

feat(nextjs): Infer the path the component is mounted at automatically in pages and app router#2634

Merged
nikosdouvlis merged 2 commits intomainfrom
nikos/sdk-1225-use-dynamic-paths-for-components
Jan 19, 2024
Merged

feat(nextjs): Infer the path the component is mounted at automatically in pages and app router#2634
nikosdouvlis merged 2 commits intomainfrom
nikos/sdk-1225-use-dynamic-paths-for-components

Conversation

@nikosdouvlis
Copy link
Copy Markdown
Member

Description

Detailed explanation is in the comments, please take a look at the code itself.
This PR allows using all components with path routing without passing the path manually

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

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jan 18, 2024

🦋 Changeset detected

Latest commit: a548d58

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

This PR includes changesets to release 2 packages
Name Type
@clerk/nextjs Patch
@clerk/elements 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

@nikosdouvlis nikosdouvlis requested review from dimkl and octoper and removed request for dimkl January 18, 2024 20:10
);

export const SignIn = (props: SignInProps) => {
const { signInUrl } = useClerkNextOptions();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we should remove the signInUrl here, this is needed if we want to keep value coming from <ClerkProvider/> or env variable NEXT_PUBLIC_CLERK_SIGN_IN_URL.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't think we need to respect this - the env variable is supposed to be used so the SignIn component (and the middleware) knows where SignUp is mounted and vice versa.

You want to render the component at the path its mounted, and respecting the global value as the path means that the component will only be able to be mounted to a single route

};

export const SignUp = (props: SignUpProps) => {
const { signUpUrl } = useClerkNextOptions();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The same as signInUrl applies here

@nikosdouvlis nikosdouvlis merged commit 24de669 into main Jan 19, 2024
@nikosdouvlis nikosdouvlis deleted the nikos/sdk-1225-use-dynamic-paths-for-components branch January 19, 2024 00:45
brkalow pushed a commit that referenced this pull request Jan 19, 2024
…y in pages and app router (#2634)

* feat(nextjs): Infer the path the component is mounted at automatically in pages and app router

* Create early-cars-cross.md
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.

3 participants