Skip to content
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 a old entry, the Entry structure breaks #929

Closed
AleksanderKampus1 opened this issue Aug 19, 2024 · 19 comments

Comments

@AleksanderKampus1
Copy link

AleksanderKampus1 commented Aug 19, 2024

Bug Description

This bug is related to this bug: #907

While working on a old entry in Craft CMS, let's say I forget inputting a required field (such as component 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. The Neo structure breaks.

It's important to note that it only only happens to entries that where saved before updating to Neo 5.2.0. Meaning that when I make a totally new entry everything works. That's why I didn't catch it with the original bug report.

Steps to reproduce

  1. Set autoSaveDrafts to false in CMS config
  2. Choose a old entry
  3. Don't put in a required field
  4. Save it. Craft will give a validation error
  5. Fix that validation error and save it again
  6. Neo blocks will get messed up
Screen.Recording.Aug.19.1.mov

Here is also a video if I create a new entry:

Screen.Recording.Aug.19.2.mov

Expected behaviour

Neo blocks should maintain the original structure

Neo version

5.2.0

Craft CMS version

5.3.4

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

@ttempleton
Copy link
Contributor

I'm unable to reproduce this - but if you run the Craft resave/entries command, does that resolve it?

@ttempleton ttempleton added bug report status: unconfirmed A bug report that has not yet been reproduced by the maintainer(s), and more information is required and removed bug report status: new labels Aug 22, 2024
@AleksanderKampus1
Copy link
Author

AleksanderKampus1 commented Aug 23, 2024

We tried running the resave for a single entry, but unfortunately, it didn't help with the issue. Is there anything we can provide to help you debug it more effectively?

We updated Neo from version 5.0.4 to 5.2.2 and Craft from version 5.2.8 to 5.3.5. Could that cause any problems?

@AleksanderKampus1
Copy link
Author

Hey @ttempleton! I have been playing around with it more and I have found a way to break the structure in also new entries. Maybe this is a new bug or is somehow related to this.

Steps to reproduce:

  1. Set autoSaveDrafts to false in CMS config
  2. Create a new entry with an component that has a required field and don't fill the required field
  3. Save it. Craft will give a validation error
  4. Fix that validation error and save it again
  5. Everything should be fine
  6. Now delete the component that had the required field
  7. Add the component back but don't fill the required field
  8. Save and you should get a validation error
  9. Fill the require field
  10. Save and the whole structure gets messed up
  11. Refresh
  12. Now you don't see the structure messed up again but you also don't see the component anymore
  13. In addition now the entry works

@ttempleton
Copy link
Contributor

Does updating to 5.2.4 and running php craft gc/run resolve the issue? (in case this has the same underlying cause as #927)

@AleksanderKampus1
Copy link
Author

AleksanderKampus1 commented Sep 5, 2024

Unfortunately this didn't fix it :(. Tried also 5.2.5

@kubanedo
Copy link

I am encountering the same problem :(.

@AleksanderKampus1
Copy link
Author

Hey @kubanedo! If you don't mind, can you send Neo team ([email protected]) your db backup and composer files, so they can look more into it. I have problems sending mine, so I can't unfortunately do it :(

@ttempleton
Copy link
Contributor

Yes - could you please send those files in if possible @kubanedo.

@AleksanderKampus1
Copy link
Author

Hey, @krftcz, I see that you added an like, are you experiencing the same issue. If yes, can you maybe send the database and composer files? So they can look into it?

@ttempleton also did you test out these steps I mentioned earlier: #929 (comment)

@ttempleton
Copy link
Contributor

Thanks @AleksanderKampus1 - I've tried that out with a parent and child block where the child block has the required field, and the parent block has disappeared. I'll assume this is the same bug.

@ttempleton ttempleton added bug report status: confirmed A bug report that has been reproduced by the maintainer(s), but has not yet been fixed and removed bug report status: unconfirmed A bug report that has not yet been reproduced by the maintainer(s), and more information is required labels Oct 4, 2024
@kubanedo
Copy link

kubanedo commented Oct 7, 2024

Hi @AleksanderKampus1 ,

sorry for the late reply, the requested DB backup was sent to the email address. Hopefully, it will help solve the issue :).

Thanks

@kubanedo
Copy link

kubanedo commented Oct 8, 2024

Hi @AleksanderKampus1 ,

do you can think of any workaround we could you in case we would need to deploy our project on production next week and the issue wasn't solved yet?

Thanks a lot

@AleksanderKampus1
Copy link
Author

Hey @kubanedo !
The only workaround I know of is to use lower Craft-Neo version. We are using 5.0.4 and this doesn't have that issue.
Hope this helps 👍 .

Also did you send your composer files with the DB backup?

@kubanedo
Copy link

kubanedo commented Oct 8, 2024

Oh, great, will try.

Of course I didn't :D. I've sent it now.

Thanks

@kubanedo
Copy link

Hi @AleksanderKampus1, any update?
Thanks

@AleksanderKampus1
Copy link
Author

AleksanderKampus1 commented Oct 15, 2024

Hey @kubanedo ! I am just using craft-neo the same as you are so I don't have any extra information on it. But from this issue thread what I understand is that @ttempleton was able to reproduce it (I don't know if using your db dump). So I am guessing the Neo team is now working on it.

@ttempleton
Copy link
Contributor

Thanks for sending the files @kubanedo. I'm unable to reproduce this issue with your DB using the original steps to reproduce for the issue, but I'm going to try to fix the issue from #929 (comment), in case it's the same issue, before I ask for any more info.

@AleksanderKampus1
Copy link
Author

AleksanderKampus1 commented Oct 21, 2024

Hey! @ttempleton so I tried out some latest versions and it seems that in 5.2.11 you did something that made things better. Now the structure doesn't get totally jumbled up but what still happens is that the component that had validation error gets set as the most top component. Like lets say I have this kinda structure:

  1. Container
  2. Container 2
  3. Component with validation

After I fix the validation error the structure gets to set like this:

  1. Component with validation
  2. Container
  3. Container 2

Hope it helps fixing the problem. I can send a screen recording if it is a bit confusing what I explained.

@ttempleton
Copy link
Contributor

I've just released 5.2.13 which fixes the part of this issue that I could reproduce, that I'm hoping also fixes the part I couldn't reproduce. I'll close the issue for now, but let me know if it persists and I'll reopen.

@ttempleton ttempleton added bug report status: fixed and removed bug report status: confirmed A bug report that has been reproduced by the maintainer(s), but has not yet been fixed labels Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants