spicywebau / craft-neo

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

Duplicate entries appear in `orders` yaml files when deleting block types #887

Closed tremby closed 4 months ago

tremby commented 4 months ago

Bug Description

I'm quite often finding during code review one or more duplicates at the end of config/projects/neo/orders/*.yaml files.

Right now I'm looking at this diff, and the only thing I've done is deleted the "department highlights card" neo block type.

@@ -39,8 +39,8 @@
 - 'blockTypeGroup:080b02f6-816e-4266-9f50-7c2ac3d8ba5b' # Children
 - 'blockType:bedff732-5ad7-4d25-9543-63673868cafd' # Bio
 - 'blockType:cf698005-da80-438f-b310-5638b824aeac' # Career Department Card
-- 'blockType:53645874-c025-428a-b2ec-d081bc20ebc3' # Department Highlights Card
 - 'blockType:d9f5b8a6-b72c-42fa-a7a5-326d621b7902' # Restaurant
 - 'blockType:03e7a121-7774-49ad-ac2a-88e2fa3cb9f4' # Step
 - 'blockType:b4a31fa7-459b-4a03-a72a-a64c59555dc1' # Tab Slider Slide
 - 'blockType:b4a31fa7-459b-4a03-a72a-a64c59555dc1' # Tab Slider Slide
+- 'blockType:b4a31fa7-459b-4a03-a72a-a64c59555dc1' # Tab Slider Slide

If I look at the history of that file, I see that the last time it was changed, it was also on a removal of a block, and the final entry in the file got duplicated then too:

@@ -21,7 +21,6 @@
 - 'blockTypeGroup:0cda5288-1b78-4a3d-b728-0fd2972f2926' # CTA
 - 'blockType:9974efea-d4f4-457e-a94c-13f96026c631' # CTA and image trio
 - 'blockType:287d8931-99d2-4dc9-b46f-7497a7340a68' # CTA and image trio (reference)
-- 'blockType:96ac2465-4efe-4cf8-8c63-1644fb793088' # Newsletter Sign-up
 - 'blockType:1eec4ce0-ceb1-4815-bcfe-c28b21c85ea3' # Quick Actions CTA
 - 'blockType:2077f50b-6dc0-42a7-9bf5-9d7abaf685c7' # Slim CTA
 - 'blockTypeGroup:a5e1e5ad-e902-4b00-9955-f702fa13a9f6' # Related content
@@ -44,3 +43,4 @@
 - 'blockType:d9f5b8a6-b72c-42fa-a7a5-326d621b7902' # Restaurant
 - 'blockType:03e7a121-7774-49ad-ac2a-88e2fa3cb9f4' # Step
 - 'blockType:b4a31fa7-459b-4a03-a72a-a64c59555dc1' # Tab Slider Slide
+- 'blockType:b4a31fa7-459b-4a03-a72a-a64c59555dc1' # Tab Slider Slide

This doesn't appear to be dangerous, but it's confusing noise in diffs and therefore code review.

Steps to reproduce

Sorry, I don't have solid steps for this; all I can really say is that it seems to happen (sometimes?) when deleting a block type.

Expected behaviour

No duplicate entries.

Neo version

4.0.6

Craft CMS version

4.8.0

What is the affected Neo field's propagation method?

"save to all sites the owner element is saved in"

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

This is not a templating issue

ttempleton commented 4 months ago

Thanks for reporting that - fixed for the next release.