Allow setting depth
separately for each rich text element type
#3718
diesieben07
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It would be nice if you could set
depth
separately for every element type (link
,relationship
, etc.) when querying a RichTextField via GraphQL.In our use-case we have an upload element, for embedded images and a link element for external or internal links.
In case of the embedded image we obviously want
depth: 1
, so the frontend does not have to query the images separately. But in doing so, if there are any links in the rich text, the entirety of the linked document is also included in the response. This is undesired, because it is just unnecessary traffic, the frontend only needs the ID (and type) of the linked document to generate the URL to link to.My proposal would be to add a second input parameter to the rich text resolver,
depths
. This would be an object, with a key for every enabled "nested type" in the rich text field. An example query would look like this:This would query with depth 0 by default, but depth 1 for uploads.
I've created a proof of concept implementation here: main...diesieben07:feature/rich-text-depth
Currently I have just hard-coded the types
link
andrelationship
in the GraphQL type instead of actually looking at the configuration and I have also only implemented it for Slate.Beta Was this translation helpful? Give feedback.
All reactions