Mutate a value in a page contentSection

System Information
  • Strapi Version: 4.7.1
  • Operating System: Ubuntu 18
  • Database: Postgres
  • Node Version: 18.3
  • NPM Version: 8.19.3
  • Yarn Version:

How to update one value – without deleting everything else.

I’m using a modified version of the backend Corporate Template, with Global, Pages, and “Component Sections” like Hero and LargeVideo.

The case is simple, the u in crud: update one value in one of the of ComponentSections. – To support an inline-editing feature of the frontend, where content is wrapped in a CKEditor (working, ready to go) that a user can make changes to then send back to Strapi. (The ultimate goal is for content authors to avoid the admin for some changes).

What is the best approach? Is it a GraphQL Page mutation, or do I need a custom Endpoint so I can update directly. I’m just looking for general direction.

Looking in the db, a lot of the content I want to update from the client is one or two tables, eg. components_sections_rich_texts, which has a PK id – that I know on the client. But I can’t see anyway to exploit that in gql directly. So I guess the custom endpoint direction makes sense.

But there should be a way in gql, right? I’m kind of close. I figure I need to use the … on Component syntax in the update part but I can’t work it out. When I run the following, if there is a RichText component on the page, it gets updated. If there are two, only the first is updated. If there is anything else on the page running this deletes it all except other RichText components.

I’m about to go down the custom endpoint path but I thought I’d see if anyone would show me how this could work:

mutation UpdatePage($id: ID!, $newVal: String!) {
      id: $id
      data: {
        contentSections: [
          { __typename: "ComponentSectionsRichText", content: $newVal }
    ) {
      data {
        attributes {
          contentSections {
            ... on ComponentSectionsRichText {

I don’t know if this was a stupid question or a difficult one. I’d like to do this a Strapi way but I want to have this inline edit feature more, so I’m going off-the-rails, so to speak, to make a sidecar node/express app to handle it, update the content directly. I’ve tested that, it works fine. I have everything I need at the client to form a post. So, node. No problem, it might be nice to have on the side for whatever. It seems like Strapi is almost a oodb kind of thing, like Zope, and it wouldn’t be too much of a stretch to allow updating objects against some objectId. In Strapi I can use a Richtext component in a dozen places that I’ll have to drill-down into to manage, but it’s all really in this one place, and the client knows where that is and the developer knows, but so far I can’t find any reasonably straight forward way to update a single value in a Dynamic Zone a native Strapi way. I assume I’m missing something.