tablemaker icon indicating copy to clipboard operation
tablemaker copied to clipboard

Creates duplicate columns when changing values (GQL)

Open sanderWDale opened this issue 3 years ago • 9 comments

Description When using GQL and updating the values on a column field it creates a duplicate item in GQL in columns array. It does not create or show up in CMS just in the GQL query columns result.

Steps to reproduce

  1. Create a value.
  2. Update value.
  3. Duplicate appears.

Additional info

  • Plugin version: dev-craft-4 as 4.0.1
  • Craft version: 4.0.4
  • Multi-site: Yes

Additional context

sanderWDale avatar Jul 01 '22 10:07 sanderWDale

Can you please provide the mutation query you're using?

engram-design avatar Jul 02 '22 01:07 engram-design

We do not use GQL to update/create the table. This happens when we are grabbing the table info from the CMS with GQL.

sanderWDale avatar Jul 04 '22 07:07 sanderWDale

Ah okay, you just state "when changing values" and in your reproduction steps you state "create a value, update a value" - what value? A column in the field? A row? Or updating an other field in the entry that isn't a Table Maker field?

I can't seem to replicate this.

CleanShot 2022-07-04 at 17 19 35

image

engram-design avatar Jul 04 '22 07:07 engram-design

It happens when you for example update the width on the table columns. Write in 30%. Save and load the page. Then go back and change it to 100%. When I do this it creates a duplicate of the column.

sanderWDale avatar Jul 04 '22 07:07 sanderWDale

Thanks for confirming. I've tested that and making all sorts of changes including adding/removing new columns, changing names, widths, alignments, but everything appear to be behaving. Can you provide a screenshot of the response in the GraphiQL explorer?

engram-design avatar Jul 04 '22 08:07 engram-design

The duplicate column does not show up in the GQL explorer but it does show up in the frontend and when using a console.log on the query data. I recreated it again now by changing width 3 times in short succession. After that duplicates will be created on each item you update.

sanderWDale avatar Jul 04 '22 08:07 sanderWDale

Hmm, shouldn't the result be the identical? It's all the same querying mechanism. It wouldn't have anything to do with local caching on the client-side or anything (if that's something in your project)?

Can you send through a screenshot from your front-end, showing the raw payload data as a network request from the GQL endpoint to illustrate? Just to see what sort of duplicate response looks like.

engram-design avatar Jul 04 '22 09:07 engram-design

Screenshot-1 Screenshot-1 Screenshot-2 Screenshot-2

Here you can see the first query. It shows and array of 6 items. This is correct. On the second query after changing the width on the first column, there are now 7 items, and the column is created again at the end of the array.

There are still only 6 columns in the CMS.

sanderWDale avatar Jul 04 '22 09:07 sanderWDale

Certainly seems like some form of cache or something getting mismatched with that changes data. How're you querying this data from the front end? This doesn't seem to be a GQL query format I'm familiar with (Apollo), which I've just tried out without being able to replicate your results. Strange.

engram-design avatar Jul 04 '22 10:07 engram-design