From 66bf8c3cbd080ee5a28b7af521d427d3aae59ba2 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 24 Oct 2022 11:31:09 -0400 Subject: [PATCH] fix: #1286, uses defaultDepth in graphql rich text depth --- src/graphql/schema/buildObjectType.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/graphql/schema/buildObjectType.ts b/src/graphql/schema/buildObjectType.ts index 39ff724773..9fa951fc62 100644 --- a/src/graphql/schema/buildObjectType.ts +++ b/src/graphql/schema/buildObjectType.ts @@ -117,11 +117,14 @@ function buildObjectType({ [field.name]: { type: withNullableType(field, GraphQLJSON, forceNullable), async resolve(parent, args, context) { - if (args.depth > 0) { + let depth = payload.config.defaultDepth; + if (typeof args.depth !== 'undefined') depth = args.depth; + + if (depth > 0) { await createRichTextRelationshipPromise({ req: context.req, siblingDoc: parent, - depth: args.depth, + depth, field, showHiddenFields: false, });