fix(richtext-lexical): html converters can populate relationships infinitely (#7890)

Fixes https://github.com/payloadcms/payload/issues/7743
This commit is contained in:
Alessio Gravili
2024-08-27 15:24:50 -04:00
committed by GitHub
parent 3d714d3e72
commit de7ff1f8c6
15 changed files with 123 additions and 9 deletions

View File

@@ -115,11 +115,18 @@ export type FieldHookArgs<TData extends TypeWithID = any, TValue = any, TSibling
/** The collection which the field belongs to. If the field belongs to a global, this will be null. */
collection: SanitizedCollectionConfig | null
context: RequestContext
/**
* Only available in `afterRead` hooks
*/
currentDepth?: number /**
* Only available in `afterRead` hooks
*/
/** The data passed to update the document within create and update operations, and the full document itself in the afterRead hook. */
data?: Partial<TData>
/**
* Only available in the `afterRead` hook.
*/
depth?: number
draft?: boolean
/** The field which the hook is running against. */
field: FieldAffectingData

View File

@@ -204,7 +204,9 @@ export const promise = async ({
const hookedValue = await currentHook({
collection,
context,
currentDepth,
data: doc,
depth,
draft,
field,
findMany,
@@ -231,7 +233,9 @@ export const promise = async ({
const hookedValue = await currentHook({
collection,
context,
currentDepth,
data: doc,
depth,
draft,
field,
findMany,

View File

@@ -1,4 +1,4 @@
import type { FormState } from 'payload'
import type { FormState } from '../admin/types.js'
import { unflatten } from './unflatten.js'