Skip to content

Commit ed21c1c

Browse files
authored
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: ... }, }, }, }) ```
1 parent 447587a commit ed21c1c

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

packages/next/src/views/Account/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export const Account: React.FC<AdminViewProps> = async ({
138138
/>
139139
<HydrateAuthProvider permissions={permissions} />
140140
<RenderServerComponent
141-
Component={config.admin?.components?.views?.Account?.Component}
141+
Component={config.admin?.components?.views?.account?.Component}
142142
Fallback={EditView}
143143
importMap={payload.importMap}
144144
serverProps={{

packages/next/src/views/Dashboard/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const Dashboard: React.FC<AdminViewProps> = async ({
113113
Link,
114114
locale,
115115
}}
116-
Component={config.admin?.components?.views?.Dashboard?.Component}
116+
Component={config.admin?.components?.views?.dashboard?.Component}
117117
Fallback={DefaultDashboard}
118118
importMap={payload.importMap}
119119
serverProps={{

packages/payload/src/config/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,9 +764,9 @@ export type Config = {
764764
/** Add custom admin views */
765765
[key: string]: AdminViewConfig
766766
/** Replace the account screen */
767-
Account?: AdminViewConfig
767+
account?: AdminViewConfig
768768
/** Replace the admin homepage */
769-
Dashboard?: AdminViewConfig
769+
dashboard?: AdminViewConfig
770770
}
771771
}
772772
/** Extension point to add your custom data. Available in server and client. */

0 commit comments

Comments
 (0)