spicywebau / craft-neo

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

Neo field content lost upon saving entry in multi-site environment #863

Closed bavodeclercq closed 3 months ago

bavodeclercq commented 3 months ago

Bug Description

When enabling an entry for a new site, the fields are correctly copied into the draft. However, upon saving the draft, the content of the Neo field is unexpectedly deleted.

Video

Steps to reproduce

  1. Create two sites.
  2. Create a section with a custom propagation method and add a plain text field and a Neo field to the entry type.
  3. Create a new entry for the first site.
  4. Populate the Neo field with content.
  5. Save the entry.
  6. Reopen the saved entry and enable it for the second site, then save it.
  7. Notice that the content in the Neo field is now empty on the second site, while the content in the plain text field remains intact.

Expected behaviour

The Neo blocks should be consistent across both sites upon saving.

Neo version

4.0.6

Craft CMS version

4.8.0

What is the affected Neo field's propagation method?

None

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

This is not a templating issue

ttempleton commented 3 months ago

Thanks for reporting that - fixed now in 4.0.8.

bavodeclercq commented 3 months ago

It seems that a new issue has surfaced after the recent fix was pushed. I'm not sure if it's related to the fix or if it's a separate issue. When adding an existing entry to another site and saving it, the blocks appear to be recursively multiplied, resulting in an exponential increase (I guess per removal of the entry for the site, an extra block is added). This problem doesn't occur with new entries. However, it's reproducible with new entries by adding the entry to another site, then removing it for that particular site, and finally adding it again. Please see the video for reference.