spicywebau / craft-neo

A Matrix-like field type for Craft CMS that uses existing fields
Other
402 stars 63 forks source link

Querying a Draft containing a Neo field with nested blocks (level 4) using Craft's Graphiql playground returns an empty result when modified #908

Closed nedu64 closed 5 days ago

nedu64 commented 3 weeks ago

Bug Description

I currently have a Neo field which contains a few blocks used in adding various content to a page. Based on the Block configuration and the issue at hand, i noticed adding child blocks to an existing child block up to level 4 seems a bit problematic when querying its modified Drafts content as tested using Graphiql playground. Here is a bit of description of the block configuration:

Pictorial Description

Screenshot 2024-07-08 at 10 30 15 Screenshot 2024-07-08 at 10 29 21 Screenshot 2024-07-08 at 09 54 01 Screenshot 2024-07-08 at 10 34 49

Adding content to any of the Hidden Content's Block works in Live Preview when saved. However if you create a Draft from the saved page and make any modifications to any of the Hidden Content's Child Blocks, Graphiql playground returns an empty response for the Child Blocks: E.g:

Saved content below

Screenshot 2024-07-08 at 10 19 19

Query (Graphiql):

contentBuilder {
          ... on contentBuilder_contentRow_BlockType {
            children {
              ... on contentBuilder_contentColumn_BlockType {
                children {
                  ... on contentBuilder_accordion_BlockType {
                    heading
                    children {
                      ... on contentBuilder_richText_BlockType {
                        __typename
                        richText
                      }
                      ... on contentBuilder_pane_BlockType {
                        id
                        children {
                          ... on contentBuilder_richText_BlockType {
                            id
                            richText
                          }
                        }
                      }
                    }
                  }
                  ... on contentBuilder_richText_BlockType {
                    __typename
                    richText
                  }
                }
              }
            }
          }
        }

Response:

 {
      "heading": "Test heading",
      "children": [
        {
          "id": "1429731",
          "children": [
            {
              "id": "1786121",
              "richText": "<p>Saved content currently works</p>"
            }
          ]
        }
      ]
    },
drafts {
      id
      title
      ... on pages_builder_Entry {
        contentBuilder {
          ... on contentBuilder_contentRow_BlockType {
            children {
              ... on contentBuilder_contentColumn_BlockType {
                children {
                  ... on contentBuilder_accordion_BlockType {
                    heading
                    children {
                      ... on contentBuilder_richText_BlockType {
                        __typename
                        richText
                      }
                      ... on contentBuilder_pane_BlockType {
                        id
                        children {
                          ... on contentBuilder_richText_BlockType {
                            id
                            richText
                          }
                        }
                      }
                    }
                  }
                  ... on contentBuilder_richText_BlockType {
                    __typename
                    richText
                  }
                }
              }
            }
          }
        }
      }
    }

Response:

{
  "heading": "Test heading",
  "children": []
},

Steps to reproduce

  1. Create a test page in craft
  2. Add a Neo field
  3. Model your Neo field based on the example shared in the Bug Description section
    • Field name: Content Builder
    • Field type: Neo
    • Block Configuration
      • Content Row
        • Content Column (Child Block)
          • Accordion Item (Child Block)
          • Heading
          • Hidden Content (Child Block)
            • Buttons (Child Block)
            • Copy (Child Block)
            • Heading (Child Block)
            • Downloads Dropdown Buttons (Child Block)
            • Downloads Dropdown Block (Child Block)
  4. Add contents to the (Level 4) nested block (Hidden Content)
  5. Confirm that you can query your saved content using Graphiql Playground
  6. Create a draft from your saved page containing modelled Neo field
  7. Add modifications to the (Level 4) nested block (Hidden Content)
  8. Try querying Graphiql Playground again for the changes added to your saved drafts
  9. Note that all child blocks of the Hidden Content (Level 4) Block are missing

Expected behaviour

Adding changes to a nested block up to Level 4 in a created Draft, i'm able to see these changes when querying using Craft's Graphiql Playground

Neo version

4.1.2

Craft CMS version

Craft Pro 4.9.5

What is the affected Neo field's propagation method?

No response

Does this issue involve templating, and if so, is eager-loading used?

This is not a templating issue

ttempleton commented 3 weeks ago

If possible, could you please send your composer.json/lock files and database backup to plugins@spicyweb.com.au, along with directions to an entry where this reliably happens, and we'll have a look.

johnnynotsolucky commented 3 weeks ago

Thanks for looking into this @ttempleton. We won't be able to send a copy of the database for the install that we're seeing this issue on. However, we're going to test with version 4.2.7 of Neo, and if the issue we're seeing is still present, we'll set up a fresh Craft install and try and reproduce it - we would then be able to send you a copy of that DB.

nedu64 commented 2 weeks ago

If possible, could you please send your composer.json/lock files and database backup to plugins@spicyweb.com.au, along with directions to an entry where this reliably happens, and we'll have a look.

@ttempleton Done, also note that the issue is also reproducible in version 4.2.8

ttempleton commented 5 days ago

Thanks for that @nedu64 - fixed now in 4.2.9.