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: ...
      },
    },
  },
})
```
This commit is contained in:
Jacob Fletcher
2024-11-16 14:35:35 -05:00
committed by GitHub
parent 447587a01e
commit ed21c1c036
3 changed files with 4 additions and 4 deletions

View File

@@ -138,7 +138,7 @@ export const Account: React.FC<AdminViewProps> = async ({
/>
<HydrateAuthProvider permissions={permissions} />
<RenderServerComponent
Component={config.admin?.components?.views?.Account?.Component}
Component={config.admin?.components?.views?.account?.Component}
Fallback={EditView}
importMap={payload.importMap}
serverProps={{

View File

@@ -113,7 +113,7 @@ export const Dashboard: React.FC<AdminViewProps> = async ({
Link,
locale,
}}
Component={config.admin?.components?.views?.Dashboard?.Component}
Component={config.admin?.components?.views?.dashboard?.Component}
Fallback={DefaultDashboard}
importMap={payload.importMap}
serverProps={{

View File

@@ -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. */