fix: add editDepth to account view so that it doesn't redirect from modals (#7597)
Closes https://github.com/payloadcms/payload/issues/7593
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { AdminViewProps, ServerSideEditViewProps } from 'payload'
|
||||
|
||||
import { DocumentInfoProvider, HydrateAuthProvider } from '@payloadcms/ui'
|
||||
import { DocumentInfoProvider, EditDepthProvider, HydrateAuthProvider } from '@payloadcms/ui'
|
||||
import { RenderCustomComponent } from '@payloadcms/ui/shared'
|
||||
import { notFound } from 'next/navigation.js'
|
||||
import React from 'react'
|
||||
@@ -75,30 +75,32 @@ export const Account: React.FC<AdminViewProps> = async ({
|
||||
initialState={formState}
|
||||
isEditing
|
||||
>
|
||||
<DocumentHeader
|
||||
collectionConfig={collectionConfig}
|
||||
config={payload.config}
|
||||
hideTabs
|
||||
i18n={i18n}
|
||||
permissions={permissions}
|
||||
/>
|
||||
<HydrateAuthProvider permissions={permissions} />
|
||||
<RenderCustomComponent
|
||||
CustomComponent={
|
||||
typeof CustomAccountComponent === 'function' ? CustomAccountComponent : undefined
|
||||
}
|
||||
DefaultComponent={EditView}
|
||||
componentProps={viewComponentProps}
|
||||
serverOnlyProps={{
|
||||
i18n,
|
||||
locale,
|
||||
params,
|
||||
payload,
|
||||
permissions,
|
||||
searchParams,
|
||||
user,
|
||||
}}
|
||||
/>
|
||||
<EditDepthProvider depth={1}>
|
||||
<DocumentHeader
|
||||
collectionConfig={collectionConfig}
|
||||
config={payload.config}
|
||||
hideTabs
|
||||
i18n={i18n}
|
||||
permissions={permissions}
|
||||
/>
|
||||
<HydrateAuthProvider permissions={permissions} />
|
||||
<RenderCustomComponent
|
||||
CustomComponent={
|
||||
typeof CustomAccountComponent === 'function' ? CustomAccountComponent : undefined
|
||||
}
|
||||
DefaultComponent={EditView}
|
||||
componentProps={viewComponentProps}
|
||||
serverOnlyProps={{
|
||||
i18n,
|
||||
locale,
|
||||
params,
|
||||
payload,
|
||||
permissions,
|
||||
searchParams,
|
||||
user,
|
||||
}}
|
||||
/>
|
||||
</EditDepthProvider>
|
||||
</DocumentInfoProvider>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user