From ed21c1c036b8bb63f503d08917b0e6c2a8ee5aba Mon Sep 17 00:00:00 2001 From: Jacob Fletcher Date: Sat, 16 Nov 2024 14:35:35 -0500 Subject: [PATCH] fix!: proper casing for default root views (#9248) Custom `account` and `dashboard` views now defined as lowercase in the config. This is to maintain consistency with all other custom views throughout the config. The underlying reason for this change is that previously, you could define React Components directly on these properties. Now, these are strictly _view configuration objects_, and the property names have been adjusted in order to semantically reflect that. These two views in particular, however, were never updated accordingly. ## Breaking Changes ```diff import { buildConfig } from 'payload' const config = buildConfig({ // ... admin: { components: { // ... views: { // ... - Account: ... - Dashboard: ... + account: ... + dashboard: ... }, }, }, }) ``` --- packages/next/src/views/Account/index.tsx | 2 +- packages/next/src/views/Dashboard/index.tsx | 2 +- packages/payload/src/config/types.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/next/src/views/Account/index.tsx b/packages/next/src/views/Account/index.tsx index 49608f61d85..b1d6e49d183 100644 --- a/packages/next/src/views/Account/index.tsx +++ b/packages/next/src/views/Account/index.tsx @@ -138,7 +138,7 @@ export const Account: React.FC = async ({ /> = async ({ Link, locale, }} - Component={config.admin?.components?.views?.Dashboard?.Component} + Component={config.admin?.components?.views?.dashboard?.Component} Fallback={DefaultDashboard} importMap={payload.importMap} serverProps={{ diff --git a/packages/payload/src/config/types.ts b/packages/payload/src/config/types.ts index 190e1e4caa3..30ef38aec14 100644 --- a/packages/payload/src/config/types.ts +++ b/packages/payload/src/config/types.ts @@ -764,9 +764,9 @@ export type Config = { /** Add custom admin views */ [key: string]: AdminViewConfig /** Replace the account screen */ - Account?: AdminViewConfig + account?: AdminViewConfig /** Replace the admin homepage */ - Dashboard?: AdminViewConfig + dashboard?: AdminViewConfig } } /** Extension point to add your custom data. Available in server and client. */