jamesedmonston / graphql-authentication

GraphQL authentication for your headless Craft CMS applications.
Other
28 stars 22 forks source link

Unable to update Matrix field using updateViewer Mutation #148

Open Nic1911 opened 6 months ago

Nic1911 commented 6 months ago

Hi!

I'm trying to update a Matrix field via the updateViewer mutation.

The field has blocks with 3 inner fields (String):

Screenshot 2024-03-21 alle 10 18 03

In GraphQL I'm using the following Mutation:

mutation UPDATE_CART(
    $leathers: [cart_MatrixBlockContainerInput]
) {
  updateViewer(cart: {blocks: $leathers}) {
    id
    ... on User {
      id
      cart {
        ... on cart_leather_BlockType {
          id
          leatherId
        }
      }
    }
  }
}

Then I pass the following variables:

"leathers": [{
  "leather": {
      "id": "919191910" , 
      "leatherId": 5330, 
      "quantity": 100, 
     "collectionId": 5322
   }
}]

I'm also passing an Authorization token JWT and the Mutation runs without errors, but the matrix field is empty.

Does anyone had the same issue? Thanks in advance and regards,

Nicolò

Nic1911 commented 6 months ago

Using the same mutation I'm able to update others fields (String) instead.

Ex.:

mutation UPDATE_USER(
    $firstname: String,
  ) {
    updateViewer(
      firstname: $firstname,
    ) {
      id
    }
  }
{ firstname: "Nic" }

So the issue is limited to the Matrix field.

Thanks