@clerk/upgrade 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/dist/guide-generators/core-2/backend/__output.mdx +687 -0
  2. package/dist/guide-generators/core-2/chrome-extension/__output.mdx +530 -0
  3. package/dist/guide-generators/core-2/expo/__output.mdx +546 -0
  4. package/dist/guide-generators/core-2/fastify/__output.mdx +448 -0
  5. package/dist/guide-generators/core-2/gatsby/__output.mdx +503 -0
  6. package/dist/guide-generators/core-2/js/__output.mdx +628 -0
  7. package/dist/guide-generators/core-2/nextjs/__output.mdx +1169 -0
  8. package/dist/guide-generators/core-2/node/__output.mdx +592 -0
  9. package/dist/guide-generators/core-2/overview/__output.mdx +33 -0
  10. package/dist/guide-generators/core-2/overview/intro.mdx +1 -1
  11. package/dist/guide-generators/core-2/react/__output.mdx +790 -0
  12. package/dist/guide-generators/core-2/remix/__output.mdx +432 -0
  13. package/dist/guide-generators/core-2/retheme/__output.mdx +440 -0
  14. package/dist/guide-generators/core-2/shared/prepare.mdx +0 -5
  15. package/dist/guide-generators/core-2/shared/update-version.mdx +5 -5
  16. package/dist/versions/core-2/backend/members-count.md +2 -2
  17. package/dist/versions/core-2/index.js +1 -1
  18. package/dist/versions/core-2/nextjs/auth-middleware-deprecated.md +2 -2
  19. package/dist/versions/core-2/nextjs/authmiddleware-import-change.md +1 -1
  20. package/dist/versions/core-2/nextjs/with-clerk-middleware-removed.md +1 -1
  21. package/dist/versions/core-2/node/createclerkexpressrequireauth-public-key-required.md +2 -2
  22. package/dist/versions/core-2/node/createclerkexpresswithauth-publickey-required.md +7 -0
  23. package/package.json +1 -1
  24. /package/dist/versions/core-2/{js/supported-external-accounts-type-removed.md → common/supported-external-accounts-removed.md} +0 -0
@@ -0,0 +1,503 @@
1
+ ---
2
+ title: "Upgrading Gatsby to Core 2"
3
+ description: "Learn how to upgrade Clerk's Gatsby SDK to the latest version"
4
+ ---
5
+
6
+ {/* WARNING: This is a generated file and should not be edited directly. To update its contents, see the "upgrade" package in the clerk/javascript repo. */}
7
+
8
+ # Upgrading `gatsby-plugin-clerk` to Core 2
9
+
10
+ Core 2 is included in the Gatsby SDK starting with version 5. This new version ships with an improved design and UX for its built-in components, no "flash of white page" when authenticating, and a variety of smaller DX improvements and housekeeping items. Each of the potentially breaking changes are detailed in this guide, below.
11
+
12
+ By the end of this guide, you’ll have successfully upgraded your Gatsby project to use `gatsby-plugin-clerk` v5. You’ll learn how to update your dependencies, resolve breaking changes, and find deprecations. Step-by-step instructions will lead you through the process.
13
+
14
+ ## Preparing to upgrade
15
+
16
+ Before uprading, it's highly recommended that you update your Clerk SDKs to the latest Core 1 version (`npm i gatsby-plugin-clerk@4`). Some changes required for Core 2 SDKs can be applied incrementally to the v5 release, which should contribute to a smoother upgrading experience. After updating, look out for deprecation messages in your terminal and browser console. By resolving these deprecations you'll be able to skip many breaking changes from Core 2.
17
+
18
+ Additionally, some of the minumum version requirements for some base dependencies have been updated such that versions that are no longer supported or are at end-of-life are no longer guaranteed to work correctly with Clerk.
19
+
20
+ **Updating Node.js**
21
+
22
+ You need to have Node.js `18.17.0` or later installed. Last year, Node.js 16 entered EOL (End of life) status, so support for this version has been removed across Clerk SDKs. You can check your Node.js version by running `node -v` in your terminal. Learn more about how to [update and install Node.js](https://nodejs.org/en/learn/getting-started/how-to-install-nodejs).
23
+
24
+ **Updating React**
25
+
26
+ All react-dependent Clerk SDKs now require you to use React 18 or higher. You can update your project by installing the latest version of `react` and `react-dom`.
27
+
28
+ <CodeBlockTabs type="installer" options={["npm", "yarn", "pnpm"]}>
29
+ ```bash filename="terminal"
30
+ npm install react@latest react-dom@latest
31
+ ```
32
+
33
+ ```bash filename="terminal"
34
+ yarn add react@latest react-dom@latest
35
+ ```
36
+
37
+ ```bash filename="terminal"
38
+ pnpm add react@latest react-dom@latest
39
+ ```
40
+
41
+ </CodeBlockTabs>
42
+
43
+ If you are upgrading from React 17 or lower, make sure to [learn about how to upgrade your React version to 18](https://react.dev/blog/2022/03/08/react-18-upgrade-guide) as well.
44
+
45
+ ## Updating to Core 2
46
+
47
+ Whenever you feel ready, go ahead and install the latest version of any Clerk SDKs you are using. Make sure that you are prepared to patch some breaking changes before your app will work properly, however. The commands below demonstrate how to install the latest version.
48
+
49
+ <CodeBlockTabs type="installer" options={["npm", "yarn", "pnpm"]}>
50
+ ```bash filename="terminal"
51
+ npm install gatsby-plugin-clerk
52
+ ```
53
+
54
+ ```bash filename="terminal"
55
+ yarn add gatsby-plugin-clerk
56
+ ```
57
+
58
+ ```bash filename="terminal"
59
+ pnpm add gatsby-plugin-clerk
60
+ ```
61
+
62
+ </CodeBlockTabs>
63
+
64
+ ## CLI upgrade helper
65
+
66
+ Clerk now provides a `@clerk/upgrade` CLI tool that you can use to ease the upgrade process. The tool will scan your codebase and produce a list of changes you'll need to apply to your project. It should catch the vast majority of the changes needed for a successful upgrade to any SDK including Core 2. This can save you a lot of time reading through changes that don't apply to your project.
67
+
68
+ To run the CLI tool, navigate to your project and run it in the terminal:
69
+
70
+ <CodeBlockTabs type="installer" options={["npm", "yarn", "pnpm"]}>
71
+ ```bash filename="terminal"
72
+ npx @clerk/upgrade
73
+ ```
74
+
75
+ ```bash filename="terminal"
76
+ yarn dlx @clerk/upgrade
77
+ ```
78
+
79
+ ```bash filename="terminal"
80
+ pnpm dlx @clerk/upgrade
81
+ ```
82
+
83
+ </CodeBlockTabs>
84
+
85
+ If you are having trouble with `npx`, it's also possible to install directly with `npm i @clerk/upgrade -g`, and can then be run with the `clerk-upgrade` command.
86
+
87
+ ## Breaking Changes
88
+
89
+ ### Component design adjustments
90
+
91
+ The new version ships with improved design and UX across all of Clerk's [UI components](/docs/components/overview). If you have used the [`appearance` prop](/docs/components/customization/overview) or tokens for a [custom theme](/docs/components/customization/overview#create-a-custom-theme), you will likely need to make some adjustments to ensure your styling is still looking great. If you're using the [localization prop](/docs/components/customization/localization) you will likely need to make adjustments to account for added or removed localization keys.
92
+
93
+ [More detail on these changes &raquo;](component-redesign)
94
+
95
+ ### After sign up/in/out default value change
96
+
97
+ Defining redirect URLs for after sign up, in, and/or out via the Clerk dashboard has been removed in Core 2. In your Clerk dashboard, under "paths", there is a section called "Component paths", where URLs could be defined that had a deprecation warning. In Core 2, this functionality has been removed, and specifying redirect paths via the dashboard will no longer work. If you need to pass a redirect URL for after sign in/up/out, there are [a few different ways this can be done](https://clerk.com/docs/account-portal/custom-redirects), from environment variables to middleware to supplying them directly to the relevant components.
98
+
99
+ As part of this change, the default URL for each of these props has been set to `/`, so if you are passing `/` explicitly to any one of the above props, that line is no longer necessary and can be removed.
100
+
101
+ ```diff
102
+ - <UserButton afterSignOutUrl='/' />
103
+ + <UserButton />
104
+ ```
105
+
106
+ ### `afterSignXUrl` changes
107
+
108
+ Some changes are being made to the way that "after sign up/in url"s and redirect url props are handled as part of this new version, in order to make behavior more clear and predictable.
109
+
110
+ > We will refer to these urls as `afterSignXUrl` where `X` could be `Up` or `In` depending on the context.
111
+
112
+ Previously, setting `afterSignInUrl` or `afterSignOutUrl` would only actually redirect some of the time. If the user clicks on any form of link that takes them to a sign up/in page, Clerk automatically sets `redirect_url` in the querystring such that after the sign up or in, the user is returned back to the page they were on before. This is a common pattern for sign up/in flows, as it leads to the least interruption of the user's navigation through your app. When a `redirect_url` is present, any value passed to `afterSignInUrl` or `afterSignUpUrl` is ignored. However, if the user navigates directly to a sign up/in page, there’s no redirect url in the querystring and in this case the `afterSignInUrl` or `afterSignOutUrl` would take effect. This behavior was not intuitive and didn't give a way to force a redirect after sign up/in, so the behavior is changing to address both of these issues.
113
+
114
+ All `afterSignXUrl` props and `CLERK_AFTER_SIGN_X_URL` environment variables have been removed, and should be replaced by one of the following options:
115
+
116
+ - `signXForceRedirectUrl` / `CLERK_SIGN_X_FORCE_REDIRECT_URL` - if set, Clerk will always redirect to provided URL, regardless of what page the user was on before. Use this option with caution, as it will interrupt the user’s flow by taking them away from the page they were on before.
117
+ - `signXFallbackRedirectUrl` / `CLERK_SIGN_UP_FALLBACK_REDIRECT_URL` - if set, this will mirror the previous behavior, only redirecting to the provided URL if there is no `redirect_url` in the querystring.
118
+
119
+ If neither value is set, Clerk will redirect to the `redirect_url` if present, otherwise it will redirect to `/`. If you'd like to retain the current behavior of your app without any changes, you can switch `afterSignXUrl` with `signXFallbackRedirectUrl` as such:
120
+
121
+ ```diff
122
+ - <SignIn afterSignInUrl='/foo' />
123
+ + <SignIn signInFallbackRedirectUrl='/foo' />
124
+ ```
125
+
126
+ ### Removed: `orgs` claim on JWT
127
+
128
+ In the previous version of Clerk's SDKs, if you decode the session token that Clerk returns from the server, you'll currently find an `orgs` claim on it. It lists all the orgs associated with the given user. Now, Clerk returns the `org_id`, `org_slug`, and `org_role` of the **active** organization.
129
+
130
+ The `orgs` claim was part of the `JwtPayload`. Here are a few examples of where the `JwtPayload` could be found.
131
+
132
+ <Accordion titles={["Next.js", "Fastify", "@clerk/backend", "@clerk/clerk-sdk-node"]} heading="h5">
133
+ <AccordionPanel>
134
+ ```typescript filename="Next.js"
135
+ import { getAuth } from "@clerk/nextjs/server"
136
+ const claims: JwtPayload = getAuth(request).sessionClaims
137
+
138
+ import { getAuth } from "@clerk/ssr.server"
139
+ const claims: JwtPayload = (await getAuth(request)).sessionClaims
140
+ ```
141
+
142
+ </AccordionPanel>
143
+ <AccordionPanel>
144
+ ```typescript filename="Fastify"
145
+ import { getAuth } from "@clerk/fastify"
146
+ const claims: JwtPayload = (await getAuth(request)).sessionClaims
147
+ ```
148
+ </AccordionPanel>
149
+ <AccordionPanel>
150
+ ```typescript filename="@clerk/backend"
151
+ import { createClerkClient } from "@clerk/backend"
152
+
153
+ const clerkClient = createClerkClient({ secretKey: "" })
154
+ const requestState = await clerkClient.authenticateRequest(
155
+ request,
156
+ { publishableKey: "" }
157
+ )
158
+ const claims: JwtPayload = requestState.toAuth().sessionClaims
159
+ ```
160
+
161
+ </AccordionPanel>
162
+ <AccordionPanel>
163
+ ```typescript filename="@clerk/clerk-sdk-node"
164
+ import { clerkClient } from "@clerk/clerk-sdk-node"
165
+
166
+ router.use((...args) => clerkClient.expressRequireAuth()(...args))
167
+ router.get("/me", async (req, reply: Response) => {
168
+ return reply.json({ auth: req.auth })
169
+ })
170
+ ```
171
+
172
+ </AccordionPanel>
173
+ </Accordion>
174
+
175
+ If you would like to have your JWT return all of the user's organizations, you can create a [custom JWT template](/docs/backend-requests/making/jwt-templates) in your dashboard. Add `{ "orgs": "user.organizations" }` to it.
176
+
177
+ ### Path routing is now the default
178
+
179
+ On components like [`<SignIn />`](/docs/components/authentication/sign-in) you can define the props `routing` and `path`. `routing` can be set to `'hash' | 'path' | 'virtual'` and describes the routing strategy that should be used. `path` defines where the component is mounted when `routing="path"` is used.
180
+
181
+ In the latest version, the **default** `routing` strategy has become `'path'`. Unless you change the `routing` prop, you'll need to define the `path` prop. The affected components are:
182
+
183
+ - `<SignIn />`
184
+ - `<SignUp />`
185
+ - `<UserProfile />`
186
+ - `<CreateOrganization />`
187
+ - `<OrganizationProfile />`
188
+
189
+ Here's how you'd use the components going forward:
190
+
191
+ ```jsx
192
+ <SignIn path="/sign-in" />
193
+ <SignUp path="/sign-up" />
194
+ <UserProfile path="/user-profile" />
195
+ <CreateOrganization path="/create-org" />
196
+ <OrganizationProfile path="/org-profile" />
197
+ ```
198
+
199
+ If you don't define the `path` prop an error will be thrown. Of course, you can still use `routing="hash"` or `routing="virtual"`.
200
+
201
+ ```jsx
202
+ <UserProfile routing="hash" />
203
+ <OrganizationProfile routing="virtual" />
204
+ ```
205
+
206
+
207
+
208
+ ### Image URL Name Consolidation
209
+
210
+ There are a number of Clerk primitives that contain images, and previously they each had different property names, like `avatarUrl`, `logoUrl`, `profileImageUrl`, etc. In order to promote consistency and make it simpler for developers to know where to find associated images, all image properties are now named `imageUrl`. See the list below for all affected classes:
211
+
212
+ <Accordion titles={["<code>Organization.logoUrl</code> -&gt; <code>Organization.imageUrl</code>", "<code>User.profileImageUrl</code> -&gt; <code>.imageUrl</code>", "<code>ExternalAccount.avatarUrl</code> -&gt; <code>.imageUrl</code>", "<code>OrganizationMembershipPublicUserData.profileImageUrl</code> -&gt; <code>.imageUrl</code>"]}>
213
+ <AccordionPanel>
214
+ The `logoUrl` property of any [`Organization` object](https://clerk.com/docs/references/javascript/organization/organization#organization) has been changed to `imageUrl`.
215
+ </AccordionPanel>
216
+ <AccordionPanel>
217
+ The `profileImageUrl` property of any `User` object has been changed to `imageUrl`.
218
+ </AccordionPanel>
219
+ <AccordionPanel>
220
+ The `avatarUrl` property of any [`ExternalAcccount` object](https://clerk.com/docs/references/javascript/external-account) has been changed to `imageUrl`.
221
+ </AccordionPanel>
222
+ <AccordionPanel>
223
+ The `profileImageUrl` property of any `OrganizationMembershipPublicUserData` object has been changed to `imageUrl`.
224
+ </AccordionPanel>
225
+ </Accordion>
226
+
227
+ ### Deprecation removals & housekeeping
228
+
229
+ As part of this major version, a number of previously deprecated props, arugments, methods, etc. have been removed. Additionally there have been some changes to things that are only used internally, or only used very rarely. It's highly unlikely that any given app will encounter any of these items, but they are all breaking changes, so they have all been documented below.
230
+
231
+ <Callout type='info'>
232
+ For this section more than any other one, please use the CLI upgrade tool (`npx @clerk/upgrade`). Changes in this
233
+ section are very unlikely to appear in your codebase, the tool will save time looking for them.
234
+ </Callout>
235
+
236
+ #### Deprecation removals
237
+
238
+ <Accordion titles={["<code>User.update({ password: &#39;x&#39; })</code> -&gt; <code>User.updatePassword(&#39;x&#39;)</code>", "<code>frontendApi</code> -&gt; <code>publishableKey</code> as prop to <code>ClerkProvider</code>", "<code>afterSwitchOrganizationUrl</code> -&gt; <code>afterSelectOrganizationUrl</code> in <code>OrganizationSwitcher</code>", "<code>ClerkProviderOptionsWrapper</code> type removed", "<code>CLERK_API_KEY</code> replaced by <code>CLERK_SECRET_KEY</code>", "<code>apiKey</code> -&gt; <code>secretKey</code> as param to createClerkClient", "<code>GASTBY_CLERK_FRONTEND_API</code> replaced by <code>GATSBY_CLERK_PUBLISHABLE_KEY</code>", "<code>frontendApi</code> -&gt; <code>publishableKey</code> as param to createClerkClient"]}>
239
+ <AccordionPanel>
240
+ If you are updating a user's password via the [`User.update` method](https://clerk.com/docs/references/javascript/user/user#update), it must be changed to [`User.updatePassword`](https://clerk.com/docs/references/javascript/user/password-management#update-password) instead. This method will require the current password as well as the desired new password. We made this update to improve the security of password changes. Example below:
241
+
242
+ ```diff
243
+ - user.update({ password: 'foo' });
244
+
245
+ + user.updatePassword({
246
+ + currentPassword: 'bar',
247
+ + newPassword: 'foo',
248
+ + signOutOfOtherSessions: true,
249
+ + });
250
+ ```
251
+ </AccordionPanel>
252
+ <AccordionPanel>
253
+ The `frontendApi` prop passed to `<ClerkProvider>` was renamed to `publishableKey`. **Note:** The values are different, so this is not just a key replacement. You can visit your [Clerk dashboard](https://dashboard.clerk.com/last-active?path=api-keys) to copy/paste the new keys after choosing your framework. Make sure to update this in all environments (e.g. dev, staging, production). [More information](/docs/deployments/overview#api-keys-and-environment-variables).
254
+ </AccordionPanel>
255
+ <AccordionPanel>
256
+ The `afterSwitchOrganizationUrl` prop on the `<OrganizationSwitcher />` component has been renamed to `afterSelectOrganizationUrl`. This is a quick and simple rename.
257
+
258
+ ```diff
259
+ - <OrganizationSwitcher afterSwitchOrganizationUrl='...' />
260
+ + <OrganizationSwitcher afterSelectOrganizationUrl='...' />
261
+ ```
262
+ </AccordionPanel>
263
+ <AccordionPanel>
264
+ This type was extending `ClerkProviderProps` with but was not necessary. This type is typically used internally and is not required to be imported and used directly. If needed, import and use `ClerkProviderProps` instead.
265
+ </AccordionPanel>
266
+ <AccordionPanel>
267
+ The `CLERK_API_KEY` environment variable was renamed to `CLERK_SECRET_KEY`. You can visit your [Clerk dashboard](https://dashboard.clerk.com/last-active?path=api-keys) to copy/paste the new keys after choosing your framework. Make sure to update this in all environments (e.g. dev, staging, production).
268
+ </AccordionPanel>
269
+ <AccordionPanel>
270
+ The `apiKey` argument passed to `createClerkClient` must be changed to `secretKey`.
271
+
272
+ ```diff
273
+ import { createClerkClient } from 'gatsby-plugin-clerk/api';
274
+
275
+ - createClerkClient({ apiKey: '...' });
276
+ + createClerkClient({ secretKey: '...' });
277
+ ```
278
+ </AccordionPanel>
279
+ <AccordionPanel>
280
+ If you are using a `GATSBY_CLERK_FRONTEND_API` environment variable, the name must be changed to `GATSBY_CLERK_PUBLISHABLE_KEY` instead. Note that the values are different as well, so this is not just a key replacement. You can find the publishable key in your Clerk dashboard. Make sure you do this in both your dev and production environments.
281
+ </AccordionPanel>
282
+ <AccordionPanel>
283
+ The `frontendApi` argument passed to `createClerkClient` must be changed to `publishableKey`. Note that the values of the two keys are different, so both keys and values need to be changed. You can find your application's publishable key in the Clerk dashboard.
284
+
285
+ ```diff
286
+ import { createClerkClient } from 'gatsby-plugin-clerk/api';
287
+
288
+ - createClerkClient({ frontendApi: '...' });
289
+ + createClerkClient({ publishableKey: '...' });
290
+ ```
291
+ </AccordionPanel>
292
+ </Accordion>
293
+
294
+ #### Other Breaking changes
295
+
296
+ <Accordion titles={["<code>MagicLinkErrorCode</code> -&gt; <code>EmailLinkErrorCode</code>", "<code>useMagicLink</code> -&gt; <code>useEmailLink</code>", "<code>isMagicLinkError</code> -&gt; <code>isEmailLinkError</code>", "<code>MagicLinkError</code> -&gt; <code>EmailLinkError</code>", "<code>handleMagicLinkVerification</code> -&gt; <code>handleEmailLinkVerification</code>", "<code>invitationList</code> -&gt; <code>invitations</code> as param to <code>useOrganizations</code>", "<code>membershipList</code> -&gt; <code>members</code> as param to <code>useOrganization</code>", "<code>useOrganizations</code> -&gt; <code>useOrganizationList</code>", "<code>userProfile</code> -&gt; <code>userProfileProps</code> for <code>UserButton</code>", "<code>MultisessionAppSupport</code> import moved to <code>/internal</code>", "Replace <code>signOutCallback</code> prop on <code>SignOutButton</code> with <code>redirectUrl</code>", "<code>setSession</code> -&gt; <code>setActive</code>", "<code>Organization.create(&#39;x&#39;)</code> -&gt; <code>Organization.create({ name: &#39;x&#39; })</code>", "<code>Organization.getPendingInvitations()</code> -&gt; <code>Organization.getInvitations({ status: &#39;pending&#39; })</code>", "<code>API_URL</code> value has changed", "<code>withServerAuth</code> props.auth return type changed", "<code>Clerk</code> -&gt; <code>{ createClerkClient }</code>"]}>
297
+ <AccordionPanel>
298
+ Across Clerk's documentation and codebases the term "magic link" was changed to "email link" as it more accurately reflects the functionality.
299
+ </AccordionPanel>
300
+ <AccordionPanel>
301
+ Across Clerk's documentation and codebases the term "magic link" was changed to "email link" as it more accurately reflects functionality.
302
+ </AccordionPanel>
303
+ <AccordionPanel>
304
+ Across Clerk's documentation and codebases the term "magic link" was changed to "email link" as it more accurately reflects the functionality.
305
+ </AccordionPanel>
306
+ <AccordionPanel>
307
+ Across Clerk's documentation and codebases the term "magic link" was changed to "email link" as it more accurately reflects the functionality.
308
+ </AccordionPanel>
309
+ <AccordionPanel>
310
+ Across Clerk's documentation and codebases the term "magic link" was changed to "email link" as it more accurately reflects functionality.
311
+ </AccordionPanel>
312
+ <AccordionPanel>
313
+ The `invitationList` param to the `useOrganizations` hook has been replaced by `invitations`. This param also has a slightly different way of working, examples included below. Note also that `useOrganizations` is deprecated and should be updated to `useOrganization` instead.
314
+
315
+ ```js
316
+ // before
317
+ const { invitationList } = useOrganization({
318
+ invitationList: { limit: 10, offset: 1 },
319
+ });
320
+
321
+ // after
322
+ const { invitations } = useOrganization({
323
+ invitations: {
324
+ initialPage: 1,
325
+ pageSize: 10,
326
+ },
327
+ });
328
+
329
+ // you can also simply return all invitations
330
+ const { invitations } = useOrganization({ invitations: true });
331
+ ```
332
+ </AccordionPanel>
333
+ <AccordionPanel>
334
+ The `membershipList` param from the `useOrganization` hook has been removed. Instead, [use the `memberships` param](https://clerk.com/docs/references/react/use-organization#parameters). Examples of each can be seen here:
335
+
336
+ ```js
337
+ // before
338
+ const { membershipList } = useOrganization({
339
+ membershipList: { limit: 10, offset: 1 },
340
+ });
341
+
342
+ // after
343
+ const { memberships } = useOrganization({
344
+ memberships: {
345
+ initialPage: 1,
346
+ pageSize: 10,
347
+ },
348
+ });
349
+
350
+ // you can also simply return all memberships
351
+ const { memberships } = useOrganization({ memberships: true });
352
+ ```
353
+ </AccordionPanel>
354
+ <AccordionPanel>
355
+ Any place where `useOrganizations` is used should be switched to [`useOrganizationList`](https://clerk.com/docs/references/react/use-organization-list) or [`useOrganization`](https://clerk.com/docs/references/react/use-organization) instead. The return signature has also changed, so take note of this when making the upgrade.
356
+
357
+ ```js
358
+ // before: useOrganizations return values
359
+ {
360
+ isLoaded: boolean,
361
+ createOrganization: clerk.createOrganization,
362
+ getOrganizationMemberships: clerk.getOrganizationMemberships,
363
+ getOrganization: clerk.getOrganization,
364
+ }
365
+
366
+ // after: useOrganizationList return values
367
+ {
368
+ isLoaded: boolean,
369
+ createOrganization: clerk.createOrganization,
370
+ userMemberships: PaginatedResourcesWithDefault<...> | PaginatedResources<...>,
371
+ userInvitations: PaginatedResourcesWithDefault<...> | PaginatedResources<...>,
372
+ userSuggestions: PaginatedResourcesWithDefault<...> | PaginatedResources<...>,
373
+ setActive: clerk.setActive,
374
+ }
375
+ ```
376
+ </AccordionPanel>
377
+ <AccordionPanel>
378
+ The `userProfile` prop on [the `UserButton` component](https://clerk.com/docs/references/javascript/clerk/user-button#user-button-component) has been changed to `userProfileProps`. This is purely a name change, none of the values need to be updated.
379
+
380
+ ```diff
381
+ - <UserButton userProfile={} />
382
+ + <UserButton userProfileProps={} />
383
+ ```
384
+ </AccordionPanel>
385
+ <AccordionPanel>
386
+ `MultiSessionAppSupport` is a component that handles the intermediate “undefined” state for multisession apps by unmounting and remounting the components during the session switch (`setActive` call) in order to solve theoretical edge-cases that can arise while switching sessions. It is undocumented and intended only for internal use, so it has been moved to an `/internal` import path. Please note that internal imports are not intended for public use, and are outside the scope of semver.
387
+
388
+ ```diff
389
+ - import { MultiSessionAppSupport } from '@clerk/clerk-react'
390
+ + import { MultiSessionAppSupport } from '@clerk/clerk-react/internal'
391
+ ```
392
+ </AccordionPanel>
393
+ <AccordionPanel>
394
+ The `signOutCallback` prop on the [`<SignOutButton />` component](https://clerk.com/docs/components/unstyled/sign-out-button) has been removed. Instead, you can use the `redirectUrl` prop. Example below:
395
+
396
+ ```diff
397
+ import { SignOutButton } from "@clerk/clerk-react";
398
+
399
+ export const Signout = () => {
400
+ return (
401
+ <SignOutButton
402
+ - signOutCallback={() => { window.location.href = "/your-path" }}
403
+ + redirectUrl="/your-path"
404
+ >
405
+ <button>Sign Out</button>
406
+ </SignOutButton>
407
+ )
408
+ }
409
+ ```
410
+ </AccordionPanel>
411
+ <AccordionPanel>
412
+ `setSession` should be replaced with `setActive`. The format of the parameters has changed slightly - `setActive` takes an object where `setSession` took params directly. The `setActive` function also can accept an `organization` param that is used to set the currently active organization. The return signature did not change. Read the [API documentation](/docs/references/javascript/clerk/session-methods#set-active) for more detail. This function should be expected to be returned from one of the following Clerk hooks: `useSessionList`, `useSignUp`, or `useSignIn`. Some migration examples:
413
+
414
+ ```diff
415
+ - await setSession('sessionID', () => void)
416
+ + await setActive({ session: 'sessionID', beforeEmit: () => void })
417
+
418
+ - await setSession(sessionObj)
419
+ + await setActive({ session: sessionObj })
420
+
421
+ - await setSession(sessionObj, () => void)
422
+ + await setActive({ session: sessionObj, beforeEmit: () => void })
423
+ ```
424
+
425
+ `setActive` also supports setting an active organization:
426
+
427
+ ```js
428
+ await setActive({
429
+ session: 'sessionID',
430
+ organization: 'orgID',
431
+ beforeEmit: () => void
432
+ })
433
+
434
+ await setActive({
435
+ session: sessionObj,
436
+ organization: orgObj,
437
+ beforeEmit: () => void
438
+ })
439
+ ```
440
+ </AccordionPanel>
441
+ <AccordionPanel>
442
+ Passing a string as an argument to `Organization.create` is no longer possible - instead, pass an object with the `name` property.
443
+
444
+ ```diff
445
+ - Organization.create('...');
446
+ + Organization.create({ name: '...' });
447
+ ```
448
+ </AccordionPanel>
449
+ <AccordionPanel>
450
+ The `Organization.getPendingInvitations()` method has been removed. You can use `Organization.getInvitations` instead.
451
+
452
+ ```diff
453
+ - Organization.getPendingInvitations();
454
+ + Organization.getInvitations({ status: 'pending' });
455
+ ```
456
+ </AccordionPanel>
457
+ <AccordionPanel>
458
+ The value of this export has changed from `https://api.clerk.dev` to `https://api.clerk.com`. If you were relying on the text content of this value not changing, you may need to make adjustments.
459
+ </AccordionPanel>
460
+ <AccordionPanel>
461
+ When utilizing the `withServerAuth` helper in Gatsby, it expects a callback function that is called with props from Clerk internals. The `.auth` property on the returned object from the callback has seen a substantial change in its return type. Below is a code example of where the `auth` prop might be found:
462
+
463
+ ```js
464
+ import { withServerAuth } from 'gatsby-plugin-clerk/ssr';
465
+
466
+ export const getServerData: GetServerData<any> = withServerAuth(async props => {
467
+ return { props: { data: '...', auth: props.auth } };
468
+ });
469
+ ```
470
+
471
+ And here's a diff of the changes in the return type. The breaking change here specifically is that the property `auth.claims` was changed to `auth.sessionClaims`. Additionally, there is more information on the response that can be utilized if helpful.
472
+
473
+ ```diff
474
+ // return type diff
475
+ {
476
+ sessionId: string | null;
477
+ userId: string | null;
478
+ actor: ActJWTClaim | null;
479
+ getToken: ServerGetToken;
480
+ - claims: ClerkJWTClaims | null;
481
+ + sessionClaims: JwtPayload;
482
+ + session: Session | undefined | null;
483
+ + user: User | undefined | null;
484
+ + orgId: string | undefined | null;
485
+ + orgRole: string | undefined | null;
486
+ + orgSlug: string | undefined | null;
487
+ + organization: Organization | undefined | null;
488
+ + debug: AuthObjectDebug;
489
+ };
490
+ ```
491
+ </AccordionPanel>
492
+ <AccordionPanel>
493
+ The `Clerk` default import has changed to `createClerkClient` and been moved to a named import rather than default. You must update your import path in order for it to work correctly. Example below of the fix that needs to be made:
494
+
495
+ ```diff
496
+ - import Clerk from "gatsby-plugin-clerk"
497
+ + import { createClerkClient } from "gatsby-plugin-clerk"
498
+ ```
499
+ </AccordionPanel>
500
+ </Accordion>
501
+
502
+
503
+