Skip to content

Commit

Permalink
(chore) server side --> server-side; client side --> client-side (#1597)
Browse files Browse the repository at this point in the history
Co-authored-by: victoria <[email protected]>
  • Loading branch information
alexisintech and victoriaxyz authored Oct 4, 2024
1 parent e53df48 commit d62c4a5
Show file tree
Hide file tree
Showing 27 changed files with 52 additions and 52 deletions.
2 changes: 1 addition & 1 deletion docs/custom-flows/embedded-email-links.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ This guide will demonstrate how to generate a sign-in token and use it to sign i
import { useUser, useSignIn } from '@clerk/nextjs'
import { useEffect, useState } from 'react'

// Get the token from the query param server side, and pass through props
// Get the token from the query param server-side, and pass through props
export const getServerSideProps: GetServerSideProps = async (context) => {
return {
props: { signInToken: context.query.token ? context.query.token : null },
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/add-onboarding-flow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL=/onboarding

## Use `publicMetadata` to track user onboarding state

Each Clerk user has a `User` object that contains a `publicMetadata` property, which can be used to store custom data about the user. This information can be accessed on the client side and can be used to drive application state. [Learn more about public metadata.](/docs/users/metadata#public-metadata)
Each Clerk user has a `User` object that contains a `publicMetadata` property, which can be used to store custom data about the user. This information can be accessed on the client-side and can be used to drive application state. [Learn more about public metadata.](/docs/users/metadata#public-metadata)

You can use the user's `publicMetadata` to track the user's onboarding state. To do this, you will create:

Expand Down
4 changes: 2 additions & 2 deletions docs/guides/authjs-migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ This guide shows how to migrate an application using Auth.js (formerly NextAuth.

### Read user and session data

#### Server side
#### Server-side

Replace any Auth.js `getServerSession(req, res, authOptions)` with Clerk's helpers.

Expand Down Expand Up @@ -283,7 +283,7 @@ This guide shows how to migrate an application using Auth.js (formerly NextAuth.
</Tabs>

> [!NOTE]
> You can not access the above from the client side. If you are using one of Clerk's hooks, then you will need to check if `externalID` exists. If it doesn't, then read the `userId`.
> You can not access the above from the client-side. If you are using one of Clerk's hooks, then you will need to check if `externalID` exists. If it doesn't, then read the `userId`.
#### Update your database

Expand Down
2 changes: 1 addition & 1 deletion docs/integrations/databases/supabase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ For interacting with the Supabase dashboard, you can either use the **Supabase i

The `createClerkSupabaseClient()` function uses [Supabase's `createClient()` method](https://supabase.com/docs/reference/javascript/initializing) to initialize a new Supabase client, but modifies it to inject the Clerk token you [created with the Supabase JWT template](#create-a-supabase-jwt-template) into the request headers sent to Supabase. The `requesting_user_id()` function that was created in the Supabase dashboard will parse this token to use it when querying data from the `tasks` table.

<Tabs items={["Client side rendering", "Server side rendering"]}>
<Tabs items={["Client-side rendering", "Server-side rendering"]}>
<Tab>
The following example uses the [Next.js SDK](/docs/references/nextjs/overview) to access the [`useUser()`](/docs/references/react/use-user) and [`useSession()`](/docs/references/react/use-session) hooks, but you can adapt this code to work with any React-based Clerk SDK.

Expand Down
2 changes: 1 addition & 1 deletion docs/quickstarts/nextjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ description: Add authentication and user management to your Next.js app with Cle
---

- [Client Side Helpers](/docs/references/nextjs/overview#client-side-helpers)
- Learn more about Next.js client side helpers and how to use them.
- Learn more about Next.js client-side helpers and how to use them.

---

Expand Down
4 changes: 2 additions & 2 deletions docs/quickstarts/react.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ React has many options for handling routing, and you are free to choose the opti

## More resources

You can also learn more about Clerk components, how to customize them, and how to use Clerk's client side helpers. The following guides will help you get started.
You can also learn more about Clerk components, how to customize them, and how to use Clerk's client-side helpers. The following guides will help you get started.

<Cards>
- [Prebuilt Components](/docs/components/overview)
Expand All @@ -211,5 +211,5 @@ You can also learn more about Clerk components, how to customize them, and how t
---

- [Client Side Helpers](/docs/references/react/use-user)
- Learn more about our client side helpers and how to use them.
- Learn more about our client-side helpers and how to use them.
</Cards>
6 changes: 3 additions & 3 deletions docs/quickstarts/remix.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ Learn how to use Clerk to quickly and easily add secure authentication and user

### Protect your pages

#### Client side
#### Client-side

To protect your pages on the client side, you can use Clerk's [prebuilt control components](/docs/components/overview) that control the visibility of content based on the user's authentication state.
To protect your pages on the client-side, you can use Clerk's [prebuilt control components](/docs/components/overview) that control the visibility of content based on the user's authentication state.

The following example uses the following components:

Expand Down Expand Up @@ -231,7 +231,7 @@ Learn how to use Clerk to quickly and easily add secure authentication and user
}
```

#### Server side
#### Server-side

To protect your routes, use the [`getAuth()`](/docs/references/nextjs/get-auth) function in your loader. This function retrieves the authentication state from the request object, returning an `Auth` object that includes the `userId`, allowing you to determine if the user is authenticated.

Expand Down
6 changes: 3 additions & 3 deletions docs/quickstarts/tanstack-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ Learn how to use Clerk to quickly and easily add secure authentication and user

### Protect your pages

#### Client side
#### Client-side

To protect your pages on the client side, you can use Clerk's [prebuilt control components](/docs/components/overview#what-are-control-components) that control the visibility of content based on the user's authentication state.
To protect your pages on the client-side, you can use Clerk's [prebuilt control components](/docs/components/overview#what-are-control-components) that control the visibility of content based on the user's authentication state.

The following example uses the following components:

Expand Down Expand Up @@ -187,7 +187,7 @@ Learn how to use Clerk to quickly and easily add secure authentication and user
}
```

#### Server side
#### Server-side

To protect your routes, create a [server function](https://tanstack.com/router/latest/docs/framework/react/start/server-functions) that checks the user's authentication state via Clerk's [`getAuth()`](/docs/references/tanstack-start/get-auth) method. If the user is not authenticated, they are redirected to a sign-in page. If authenticated, the user's `userId` is passed to the route, allowing access to the `<Home />` component, which welcomes the user and displays their `userId`. The [`beforeLoad()`](https://tanstack.com/router/latest/docs/framework/react/api/router/RouteOptionsType#beforeload-method) method ensures authentication is checked before loading the page, and the [`loader()`](https://tanstack.com/router/latest/docs/framework/react/api/router/RouteOptionsType#loader-method) method returns the user data for use in the component.

Expand Down
4 changes: 2 additions & 2 deletions docs/references/astro/react.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,6 @@ If you have not set up your Astro application to work with Clerk, visit the [Ast

---

- [Client side helpers](/docs/references/astro/overview#client-side-helpers)
- Learn more about Astro client side helpers and how to use them.
- [Client-side helpers](/docs/references/astro/overview#client-side-helpers)
- Learn more about Astro client-side helpers and how to use them.
</Cards>
4 changes: 2 additions & 2 deletions docs/references/astro/read-session-data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Learn how to use Clerk's hooks and helpers to access the active ses

Clerk provides helpers that you can use to access the active session and user data in your Astro application.

## Server side
## Server-side

The following example uses the [`auth()`](/docs/references/nextjs/auth){{ target: '_blank' }} local to validate an authenticated user and the [`currentUser()`](/docs/references/nextjs/current-user){{ target: '_blank' }} local to access the [`Backend API User`](/docs/references/backend/types/backend-user){{ target: '_blank' }} object for the authenticated user.

Expand Down Expand Up @@ -35,7 +35,7 @@ The following example uses the [`auth()`](/docs/references/nextjs/auth){{ target
```
</CodeBlockTabs>

## Client side
## Client-side

Clerk Astro provides a set of useful [stores](/docs/references/astro/overview#client-side-helpers) that give you access to many important objects, such as the `Clerk`, `User`, and `Session` object.

Expand Down
4 changes: 2 additions & 2 deletions docs/references/astro/user-store.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ For more information, see the [`User` reference.](/docs/references/javascript/us

### Update the current user data

The following example demonstrates how to use the `$userStore` store to update the current user's data on the client side.
The following example demonstrates how to use the `$userStore` store to update the current user's data on the client-side.

For more information on the `update()` method, see the [`User` reference.](/docs/references/javascript/user/user#update){{ target: '_blank' }}

Expand Down Expand Up @@ -160,7 +160,7 @@ For more information on the `update()` method, see the [`User` reference.](/docs

### Reload user data

The following example demonstrates how to use the `$userStore` store to reload the current user's data on the client side.
The following example demonstrates how to use the `$userStore` store to reload the current user's data on the client-side.

For more information on the `reload()` method, see the [`User` reference.](/docs/references/javascript/user/user#reload){{ target: '_blank' }}

Expand Down
6 changes: 3 additions & 3 deletions docs/references/expo/local-credentials.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ This guide shows you how to use the `useLocalCredentials()` hook to enhance your

## More resources

Use the following guides to learn more about Clerk components, how to build custom flows for your native apps, and how to use Clerk's client side helpers.
Use the following guides to learn more about Clerk components, how to build custom flows for your native apps, and how to use Clerk's client-side helpers.

<Cards>
- [Expo SDK](/docs/quickstarts/expo)
Expand All @@ -208,6 +208,6 @@ Use the following guides to learn more about Clerk components, how to build cust

---

- [Client side helpers](/docs/references/react/use-user)
- Clerk's client side helpers enable you to access user data and perform actions on the client side.
- [Client-side helpers](/docs/references/react/use-user)
- Clerk's client-side helpers enable you to access user data and perform actions on the client-side.
</Cards>
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ This guide uses [Expo Router](https://docs.expo.dev/router/introduction/) and th

## More resources

Use the following guides to learn more about Clerk components, how to build custom flows for your native apps, and how to use Clerk's client side helpers.
Use the following guides to learn more about Clerk components, how to build custom flows for your native apps, and how to use Clerk's client-side helpers.

<Cards>
- [Prebuilt components](/docs/components/overview)
Expand All @@ -73,6 +73,6 @@ Use the following guides to learn more about Clerk components, how to build cust

---

- [Client side helpers](/docs/references/react/use-user)
- Learn more about our client side helpers and how to use them.
- [Client-side helpers](/docs/references/react/use-user)
- Learn more about our client-side helpers and how to use them.
</Cards>
6 changes: 3 additions & 3 deletions docs/references/expo/web-support/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ If you already have an Expo project and want to add web support, you must first
## More resources

Use the following guides to learn more about Clerk components, how to build custom flows for your native apps, and how to use Clerk's client side helpers.
Use the following guides to learn more about Clerk components, how to build custom flows for your native apps, and how to use Clerk's client-side helpers.

<Cards>
- [Prebuilt components](/docs/components/overview)
Expand All @@ -36,6 +36,6 @@ Use the following guides to learn more about Clerk components, how to build cust

---

- [Client side helpers](/docs/references/react/use-user)
- Learn more about our client side helpers and how to use them.
- [Client-side helpers](/docs/references/react/use-user)
- Learn more about our client-side helpers and how to use them.
</Cards>
4 changes: 2 additions & 2 deletions docs/references/nextjs/build-clerk-props.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: '`buildClerkProps`'
description: Clerk uses buildClerkProps to inform the client side helpers of the authentication state of the user. This function is used SSR in the getServerSideProps function of your Next.js application.
description: Clerk uses buildClerkProps to inform the client-side helpers of the authentication state of the user. This function is used SSR in the getServerSideProps function of your Next.js application.
---

Clerk uses `buildClerkProps` to inform the client side helpers of the authentication state of the user. This function is used SSR in the `getServerSideProps` function of your Next.js application.
Clerk uses `buildClerkProps` to inform the client-side helpers of the authentication state of the user. This function is used SSR in the `getServerSideProps` function of your Next.js application.

## Usage

Expand Down
2 changes: 1 addition & 1 deletion docs/references/nextjs/custom-signup-signin-pages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ If Clerk's prebuilt components don't meet your specific needs or if you require
---

- [Client Side Helpers](/docs/references/nextjs/overview#client-side-helpers)
- Learn more about Next.js client side helpers and how to use them.
- Learn more about Next.js client-side helpers and how to use them.

---

Expand Down
6 changes: 3 additions & 3 deletions docs/references/nextjs/read-session-data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ title: Read session and user data in your Next.js app with Clerk
description: Learn how to use Clerk's hooks and helpers to access the active session and user data in your Next.js application.
---

Clerk provides a set of [hooks and helpers](/docs/references/nextjs/overview#client-side-helpers) that you can use to access the active session and user data in your Next.js application. Here are examples of how to use these helpers in both the client and server side to get you started.
Clerk provides a set of [hooks and helpers](/docs/references/nextjs/overview#client-side-helpers) that you can use to access the active session and user data in your Next.js application. Here are examples of how to use these helpers in both the client and server-side to get you started.

## Server side
## Server-side

### App Router

Expand Down Expand Up @@ -181,7 +181,7 @@ Under the hood, `currentUser()` uses the [`clerkClient`](/docs/references/backen
</Tab>
</Tabs>

## Client side
## Client-side

### `useAuth`

Expand Down
2 changes: 1 addition & 1 deletion docs/references/react/add-react-router.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -330,5 +330,5 @@ Your application is setup with `react-router-dom` and ready for you to add more
---

- [Client Side Helpers](/docs/references/react/use-user)
- Learn more about our client side helpers and how to use them.
- Learn more about our client-side helpers and how to use them.
</Cards>
2 changes: 1 addition & 1 deletion docs/references/react/use-user.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: '`useUser()`'
description: The useUser() hook is used to get the current user object and to update the user's data on the client side.
description: The useUser() hook is used to get the current user object and to update the user's data on the client-side.
---

The `useUser()` hook is a convenient way to access the current user's [`User`](/docs/references/javascript/user/user) object, which holds all of the information for a single user of your application and provides a set of methods to manage their account. This hook also provides boolean values to check if the user is signed in and if Clerk has loaded and initialized.
Expand Down
2 changes: 1 addition & 1 deletion docs/references/redwood/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,5 @@ Now that you have an application integrated with Clerk, you will want to read th
---

- [Client Side Helpers](/docs/references/react/use-user)
- Learn more about our client side helpers and how to use them.
- Learn more about our client-side helpers and how to use them.
</Cards>
4 changes: 2 additions & 2 deletions docs/references/remix/read-session-data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ title: Read session and user data in your Remix app with Clerk
description: Learn how to use Clerk's hooks and helpers to access the active session and user data in your Remix application.
---

Clerk provides a set of [hooks and helpers](/docs/references/nextjs/overview#client-side-helpers) that you can use to access the active session and user data in your Remix application. Here are examples of how to use these helpers in both the client and server side to get you started.
Clerk provides a set of [hooks and helpers](/docs/references/nextjs/overview#client-side-helpers) that you can use to access the active session and user data in your Remix application. Here are examples of how to use these helpers in both the client and server-side to get you started.

## Server side
## Server-side

### `getAuth()`

Expand Down
4 changes: 2 additions & 2 deletions docs/references/remix/spa-mode.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ description: Clerk supports Remix SPA mode out-of-the-box.
1. Add your key to your `.env` file.

> [!WARNING]
> You will not need the Clerk Secret Key in Remix SPA mode, as it should never be used on the client side.
> You will not need the Clerk Secret Key in Remix SPA mode, as it should never be used on the client-side.
The final result should look as follows:

Expand Down Expand Up @@ -166,5 +166,5 @@ Now that you have an application integrated with Clerk, you will want to read th
---

- [Client Side Helpers](/docs/references/remix/read-session-data#client-side)
- Learn more about our client side helpers and how to use them.
- Learn more about our client-side helpers and how to use them.
</Cards>
10 changes: 5 additions & 5 deletions docs/references/tanstack-start/read-session-data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ title: Read session and user data in your TanStack Start app with Clerk
description: Learn how to use Clerk's hooks and helpers to access the active session and user data in your TanStack Start application.
---

Clerk provides a set of [hooks and helpers](/docs/references/tanstack-start/overview#client-side-helpers) that you can use to access the active session and user data in your TanStack Start application. Here are examples of how to use these helpers in both the client and server side to get you started.
Clerk provides a set of [hooks and helpers](/docs/references/tanstack-start/overview#client-side-helpers) that you can use to access the active session and user data in your TanStack Start application. Here are examples of how to use these helpers in both the client and server-side to get you started.

## Server side
## Server-side

To access active session and user data on the server side, use the `getAuth()` helper. See the [reference documentation](/docs/references/tanstack-start/get-auth) for more information, including code examples.
To access active session and user data on the server-side, use the `getAuth()` helper. See the [reference documentation](/docs/references/tanstack-start/get-auth) for more information, including code examples.

## Client side
## Client-side

To access active session and user data on the client side, use Clerk's `useAuth()` and `useUser()` hooks.
To access active session and user data on the client-side, use Clerk's `useAuth()` and `useUser()` hooks.

### `useAuth()`

Expand Down
2 changes: 1 addition & 1 deletion docs/upgrade-guides/core-2/nextjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ As part of this release, some of the top-level exports of `@clerk/nextjs` have b
titles={["@clerk/nextjs/server", "@clerk/nextjs/errors", "@clerk/nextjs/app-beta", "@clerk/nextjs/ssr", "@clerk/nextjs/edge-middleware", "@clerk/nextjs/edge-middlewarefiles", "@clerk/nextjs/api"]}
>
<AccordionPanel>
Previously these exports have been exported both from `@clerk/nextjs` and `@clerk/nextjs/server`. As of v5 they are only exported from the latter. Going forward, the expectation can be that any imports that are intended to run within react on the client side, will come from `@clerk/nextjs` and imports that are intended to run on the server, will come from `@clerk/nextjs/server`.
Previously these exports have been exported both from `@clerk/nextjs` and `@clerk/nextjs/server`. As of v5 they are only exported from the latter. Going forward, the expectation can be that any imports that are intended to run within react on the client-side, will come from `@clerk/nextjs` and imports that are intended to run on the server, will come from `@clerk/nextjs/server`.

```js {{ prettier: false, del: [14], ins: [15] }}
import {
Expand Down
Loading

0 comments on commit d62c4a5

Please sign in to comment.