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

Add organizationSyncOptions prop to clerkMiddleware() options #1634

Merged
merged 33 commits into from
Dec 20, 2024

Conversation

izaaklauer
Copy link
Contributor

@izaaklauer izaaklauer commented Oct 17, 2024

Depends on the release of clerk/javascript#4320

Preview

https://clerk.com/docs/pr/1634/references/nextjs/clerk-middleware#clerk-middleware-next-js

What changed?

This PR documents a new middleware option introduced in clerk/javascript#3977

What's next?

  • Public DX guide
  • Public changelog entry

@izaaklauer izaaklauer requested a review from a team as a code owner October 17, 2024 20:14
Comment on lines 346 to 377
- `signInUrl?`
- `publishableKey`
- `string`

An alternative sign in URL.
The Clerk publishable key for your instance. This can be found in your Clerk Dashboard on the **[API Keys](https://dashboard.clerk.com/last-active?path=api-keys)** page.

---

- `signUpUrl?`
- `secretKey?`
- `string`

An alternative sign up URL.
The Clerk secret key for your instance. This can be found in your Clerk Dashboard on the **[API Keys](https://dashboard.clerk.com/last-active?path=api-keys)** page. The `CLERK_ENCRYPTION_KEY` environment variable must be set when providing `secretKey` as an option, refer to [Dynamic keys](#dynamic-keys).

---

- `publishableKey`
- `signInUrl?`
- `string`

The Clerk publishable key for your instance. This can be found in your Clerk Dashboard on the **[API Keys](https://dashboard.clerk.com/last-active?path=api-keys)** page.
An alternative sign in URL.

---

- `secretKey?`
- `signUpUrl?`
- `string`

The Clerk secret key for your instance. This can be found in your Clerk Dashboard on the **[API Keys](https://dashboard.clerk.com/last-active?path=api-keys)** page. The `CLERK_ENCRYPTION_KEY` environment variable must be set when providing `secretKey` as an option, refer to [Dynamic keys](#dynamic-keys).
An alternative sign up URL.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is all just a re-arrangement - I noticed that the list was almost alphabetized, and now it's alphabetized.

docs/references/nextjs/clerk-middleware.mdx Outdated Show resolved Hide resolved
docs/references/nextjs/clerk-middleware.mdx Outdated Show resolved Hide resolved
Comment on lines 467 to 469
> no change will be made to the previously active organization. Components must detect this case and respond with an
> appropriate error (e. g., `notFound()`, an
> [organization switcher](/docs/components/organization/organization-switcher), etc.).
Copy link
Member

Choose a reason for hiding this comment

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

🔧 This sentence and examples in parentheses was confusing to me, because responding by rendering the org switcher doesn't seem to fall into the category of an appropriate error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

73ce834

How does that feel?

docs/references/nextjs/clerk-middleware.mdx Outdated Show resolved Hide resolved
Copy link

Hey, here’s your docs preview: https://clerk.com/docs/pr/1634

@izaaklauer izaaklauer requested a review from mzhong9723 October 22, 2024 13:54
izaaklauer and others added 3 commits October 22, 2024 10:33
It causes our linter to fail: https://github.com/clerk/clerk-docs/actions/runs/11462466478/job/31893925923?pr=1634

it'd be nice if the linter allowed for glossary links, but i'm not going to move that boulder today.
@alexisintech alexisintech changed the title Izaak/orgs 132 document org sync middleware options Izaak/orgs 132 Add organizationSyncOptions prop to clerkMiddleware() options Oct 23, 2024
@alexisintech alexisintech changed the title Izaak/orgs 132 Add organizationSyncOptions prop to clerkMiddleware() options Add organizationSyncOptions prop to clerkMiddleware() options Oct 23, 2024
docs/references/nextjs/clerk-middleware.mdx Outdated Show resolved Hide resolved
docs/references/nextjs/clerk-middleware.mdx Outdated Show resolved Hide resolved
docs/references/nextjs/clerk-middleware.mdx Outdated Show resolved Hide resolved
docs/references/nextjs/clerk-middleware.mdx Outdated Show resolved Hide resolved
docs/references/nextjs/clerk-middleware.mdx Outdated Show resolved Hide resolved
@izaaklauer izaaklauer force-pushed the izaak/orgs-132-document-org-sync-middleware-options branch from b273bfa to 7c750bc Compare October 25, 2024 15:34
@izaaklauer
Copy link
Contributor Author

Thank you @victoriaxyz for those improvements!

@victoriaxyz victoriaxyz self-requested a review October 28, 2024 21:37
docs/references/nextjs/clerk-middleware.mdx Outdated Show resolved Hide resolved
docs/references/nextjs/clerk-middleware.mdx Outdated Show resolved Hide resolved
docs/references/nextjs/clerk-middleware.mdx Show resolved Hide resolved
docs/references/nextjs/clerk-middleware.mdx Show resolved Hide resolved
victoriaxyz and others added 5 commits October 30, 2024 15:38
This reverts commit 0220928.

Decided that we like the personal account highlight. Here's my justification for any future readers who are interested

In general, our section links are quite good - the section title we link to makes it clear that the article is talking about the term of interest.
In this case, we don't have a "personal account" definition to jump to with a section link. As a user, if I was promised the definition of Personal Account and the link went to https://clerk.com/docs/organizations/organization-workspaces#organization-workspaces-in-the-clerk-dashboard,  there's a good chance i'd read the long title and think "ugh, I don't want to read up on the complete theory of organization workspaces in the dashboard right now thank you", and navigate away. I think the text highlight would point me to the part i'm actually interested in!

It's a little bit brittle though - if we restructure the page in the future so that the first appearance of "Personal account" isn't the definition, this will seem broken. Tradeoffs! I think it's worth it in this case, but not a big deal either way.
This reverts commit e9ff7c3.

We like the test highlighting after all. My justification for anyone interested:

In general, our section links are quite good - the section title we link to makes it clear that the article is talking about the term of interest.
In this case, we don't have a "personal account" definition to jump to with a section link. As a user, if I was promised the definition of Personal Account and the link went to https://clerk.com/docs/organizations/organization-workspaces#organization-workspaces-in-the-clerk-dashboard,  there's a good chance i'd read the long title and think "ugh, I don't want to read up on the complete theory of organization workspaces in the dashboard right now thank you", and navigate away. I think the text highlight would point me to the part i'm actually interested in!

It's a little bit brittle though - if we restructure the page in the future so that the first appearance of "Personal account" isn't the definition, this will seem broken. Tradeoffs! I think it's worth it in this case, but not a big deal either way.
After actually digesting https://clerk.com/docs/organizations/organization-workspaces#organization-workspaces-in-the-clerk-dashboard, i think that's probably not the best thing to link to! The use-case i'm talking to isn't about the dashboard at all - it's building custom apps. The dashboard happens to consume this feature also, so it has "personal accounts", but those docs are specifically about what personal accounts mean to the dashboard, not to any application.
docs/references/nextjs/clerk-middleware.mdx Outdated Show resolved Hide resolved
docs/references/nextjs/clerk-middleware.mdx Outdated Show resolved Hide resolved
docs/references/nextjs/clerk-middleware.mdx Outdated Show resolved Hide resolved
- <code>[Pattern](#pattern)\[]</code>

Specifies URL patterns that are organization-specific, containing an organization ID or slug as a path parameter. If a request
matches this path, the organization identifier will be extracted and activated before rendering.
Copy link
Member

Choose a reason for hiding this comment

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

when you say "the organization identifier will be activated", do you mean the organization identifier will be used to set that org as active?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, and I like your wording better!

e26600d

docs/references/nextjs/clerk-middleware.mdx Outdated Show resolved Hide resolved
@izaaklauer izaaklauer merged commit 60d3bc9 into main Dec 20, 2024
4 checks passed
@izaaklauer izaaklauer deleted the izaak/orgs-132-document-org-sync-middleware-options branch December 20, 2024 13:55
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.

4 participants