Skip to content

Commit b092754

Browse files
authored
fix: deprecates admin.disable property (#10429)
Fixes #10284. The `admin.disable` property is no longer supported as of v3. Instead, to opt-out of serving the Admin Panel, REST API, or GraphQL API, you must delete their corresponding directories within your Next.js app. For example, to opt-out of everything, delete the `/app/(payload)` directory entirely. Or to remove specifically the Admin Panel or API routes, delete the `/app/(payload)/admin` or `/app/(payload)/api` directories, respectively. Note: if you've modified the default paths for these routes via `admin.routes`, delete those directories instead.
1 parent 4d7587d commit b092754

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

docs/admin/overview.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ The `admin` directory contains all the _pages_ related to the interface itself,
5757

5858
<Banner type="warning">
5959
**Note:**
60-
If you don't use the [REST API](../rest/overview) or [GraphQL API](../graphql/overview), you can delete the [Next.js files corresponding to those routes](../admin/overview#project-structure), however, the overhead of this API is completely constrained to these endpoints, and will not slow down or affect Payload outside of the endpoints.
60+
If you don't intend to use the Admin Panel, [REST API](../rest/overview), or [GraphQL API](../graphql/overview), you can opt-out by simply deleting their corresponding directories within your Next.js app. The overhead, however, is completely constrained to these routes, and will not slow down or affect Payload outside when not in use.
6161
</Banner>
6262

6363
Finally, the `custom.scss` file is where you can add or override globally-oriented styles in the Admin Panel, such as modify the color palette. Customizing the look and feel through CSS alone is a powerful feature of the Admin Panel, [more on that here](./customizing-css).
@@ -94,7 +94,6 @@ The following options are available:
9494
| **`components`** | Component overrides that affect the entirety of the Admin Panel. [More details](./components). |
9595
| **`custom`** | Any custom properties you wish to pass to the Admin Panel. |
9696
| **`dateFormat`** | The date format that will be used for all dates within the Admin Panel. Any valid [date-fns](https://date-fns.org/) format pattern can be used. |
97-
| **`disable`** | If set to `true`, the entire Admin Panel will be disabled. |
9897
| **`livePreview`** | Enable real-time editing for instant visual feedback of your front-end application. [More details](../live-preview/overview). |
9998
| **`meta`** | Base metadata to use for the Admin Panel. [More details](./metadata). |
10099
| **`routes`** | Replace built-in Admin Panel routes with your own custom routes. [More details](#customizing-routes). |

packages/payload/src/config/client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ export const createClientConfig = ({
9292
avatar: config.admin.avatar,
9393
custom: config.admin.custom,
9494
dateFormat: config.admin.dateFormat,
95-
disable: config.admin.disable,
9695
importMap: config.admin.importMap,
9796
meta: config.admin.meta,
9897
routes: config.admin.routes,

packages/payload/src/config/defaults.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export const defaults: Omit<Config, 'db' | 'editor' | 'secret'> = {
1010
custom: {},
1111
dateFormat: 'MMMM do yyyy, h:mm a',
1212
dependencies: {},
13-
disable: false,
1413
importMap: {
1514
baseDir: `${typeof process?.cwd === 'function' ? process.cwd() : ''}`,
1615
},

packages/payload/src/config/types.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,13 @@ export type Config = {
789789
* dependency is 'component'
790790
*/
791791
dependencies?: AdminDependencies
792-
/** If set to true, the entire Admin panel will be disabled. */
792+
/**
793+
* @deprecated
794+
* This option is deprecated and will be removed in the next major version.
795+
* To disable the admin panel itself, delete your `/app/(payload)/admin` directory.
796+
* To disable all REST API and GraphQL endpoints, delete your `/app/(payload)/api` directory.
797+
* Note: If you've modified the default paths via `admin.routes`, delete those directories instead.
798+
*/
793799
disable?: boolean
794800
importMap?: {
795801
/**

0 commit comments

Comments
 (0)