-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Craft 5] If I miss a required field while saving, all neo blocks get flattened #907
Comments
I'm able to reproduce the content loss when doing this with Matrix blocks as well, so I'm guessing there is some common issue in Craft itself. I'm unsure if the Neo block structure loss is related to that or a separate bug. (For the record - yes, it is specific to |
I'm going to close this issue for now, due to being presumed to have an external cause. Happy to reopen if the content loss issue with Matrix fields is fixed in Craft and that does not also fully fix the Neo issues. |
@ttempleton can you try this again with Matrix blocks? I decided to create a bug on Craft side today. However when testing it myself I found that Matrix blocks don't get flattened. The may have fixed it on Craft side with the latest version 5.2.8 but it's still broken with Neo. Also if it keeps happening with matrix blocks, can you send us a screen recording so Craft team has more to work from? |
It looks like the field content loss has been resolved for both Matrix and Neo field types, but the Neo block structure loss is still happening. So that part now looks very likely to be a Neo bug, separate from the field content loss bug. Reopening the issue. |
Sorry, looks like that might be a Craft bug after all. It turns out that some non-field data belonging to blocks isn't being picked up, such as block level and whether the block is enabled, when the owner entry is saved. It is also happening with non-field data belonging to Matrix entries when they're set to display as blocks. This can be observed with Matrix blocks by setting blocks as disabled before the initial save that fails due to validation errors. After the second successful save attempt, the Matrix blocks will be enabled. I've opened a Craft issue for this (craftcms/cms#15418) and will reopen this issue if a resolution to the Craft issue does not also resolve this one. |
OK thanks 👍 . |
Hey @ttempleton ! The issue was marked as fixed on Craft side but the issue of flattening of Neo blocks is still there. I tried out |
Yeah, I will likely need to apply some form of the fix to Neo separately. |
I've just released Neo 5.2.0-beta.1 including a fix for this (requires at least Craft 5.3.0-beta.1). |
@ttempleton now that Craft is officially out in 5.3.1, can we also do a stable 5.2.0 release? Also tried it out and it works 👍, the Neo structure stays the same, if there is a validation errors. |
Thanks for that feedback @AleksanderKampus1! I'd like to resolve issue #917 first, so I'll release 5.2.0 on Monday. I'll update here after that's done. |
Neo 5.2.0 has now been released. |
@ttempleton can you also take a look at the new bug? This seems to be related to this. Sorry if you are already looking into it. #929 |
Bug Description
While working on a new entry in Craft CMS, let's say I forget inputting a required field (such as entry title). When I try to save the entry, I get a validation error. All's good, but now when I fix the validation error and try to save the entry again, something weird happens. All the neo blocks that I had added before get flattened and they lose their content. I tried it with a couple of neo fields with different hierarchy, this issue is reproducible with all of them.
Steps to reproduce
Screen Recording 2024-07-02 at 14.17.49.webm
Expected behaviour
Neo blocks should maintain their original hierarchy and should preserve content after save
Neo version
5.0.5
Craft CMS version
5.2.0
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
The text was updated successfully, but these errors were encountered: