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

Child block disappears after autosave #861

Open
ccchapman opened this issue Mar 5, 2024 · 14 comments
Open

Child block disappears after autosave #861

ccchapman opened this issue Mar 5, 2024 · 14 comments

Comments

@ccchapman
Copy link

ccchapman commented Mar 5, 2024

Bug Description

A newly created child block disappears after autosave.

Steps to reproduce

  1. Create an entry
  2. Add a Neo block at the root level
  3. Add a child Neo block to that block
  4. Populate field values on that child Neo block
  5. Wait for the autosave to finish
  6. Child Neo block disappears from screen

Expected behaviour

No response

Neo version

4.0.6

But we think we had the issue on 4.0.5 too.

Craft CMS version

4.8.0

What is the affected Neo field's propagation method?

"all" but the owner element is "none"

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

This is not a templating issue

@ccchapman
Copy link
Author

I have emailed in a screen recording of the issue in case any additional relevant details are observed.

@ccchapman
Copy link
Author

We searched through Craft logs and found some errors which may or may not be relevant. These errors happened close to the times we have observed issues.

2024-03-05 08:58:16 [web.ERROR] [yii\web\HttpException:400] Invalid draft ID: 375
2024-03-05 08:33:36 [web.ERROR] [yii\web\HttpException:400] Invalid draft ID: 368

We have seen these types of requests for admin/actions/elements/recent-activity and admin/actions/elements/save-draft.

@ttempleton
Copy link
Contributor

That is a pretty weird one, looking at the screen recording, since it doesn't even happen after the first edit of the child block.

If possible, could you please email the composer files and database backup, and we'll have a look.

@ccchapman
Copy link
Author

That is a pretty weird one, looking at the screen recording, since it doesn't even happen after the first edit of the child block.

If possible, could you please email the composer files and database backup, and we'll have a look.

Thank you, Thomas. I have sent the files.

I have not been able to reproduced the issue myself. We have a user that has encountered it many times in the last two weeks.

@ttempleton
Copy link
Contributor

Thanks for sending those. I'm unable to reproduce it either, so far. I'm guessing it's a timing issue with draft autosaves and Neo updating visible field layout elements, like #823. (Last I checked, updating of visible field layout elements for inline Matrix blocks in Craft 5 worked very similarly to how it currently works for Neo, so my comments in #823 are unfortunately irrelevant.)

Given that this issue involves the use of a child block UI element, a possible workaround is to remove the UI element, since it seems like the updating of visible field layout elements is causing the UI element contents to be reset.

@ccchapman
Copy link
Author

Given that this issue involves the use of a child block UI element, a possible workaround is to remove the UI element, since it seems like the updating of visible field layout elements is causing the UI element contents to be reset.

Thank you for the suggestion. We will test removing the "Child Blocks" UI element from the block type field layout.

@ccchapman
Copy link
Author

Could this be the same as #891?

@ttempleton
Copy link
Contributor

I don't think that's the same since #891 only happened when saving as a new entry, not during autosave.

Recent changes could have potentially resolved this, though; have you had it happen recently?

@ccchapman
Copy link
Author

Recent changes could have potentially resolved this, though; have you had it happen recently?

We have not seen it again; however, we still have the child blocks UI element removed.

@jesuismaxime
Copy link

I got something similar, when re-ordering to 'parent' blocks, their children got (reaaaally) mixup but since I have a condition (max. 2 blocks) on one of them, it prevent the save - still annoying since I can't reorder parent blocks (that act as sections in our layout builder).

Is there someone working on it?

(I update to the latest Craft and Neo version, still got the issue)

Here's a quick video of the bug:

Enregistrement.d.ecran.le.2024-08-05.a.14.07.58.mov

@ttempleton
Copy link
Contributor

@jesuismaxime I can't tell from your video whether you've saved before or after the draft autosave. If it was before the autosave, could you please try saving after the autosave and let me know if that works as expected?

@jesuismaxime
Copy link

jesuismaxime commented Aug 8, 2024 via email

@ttempleton
Copy link
Contributor

I can't tell from your video whether your manual save was before or after the draft autosave. Or do you have Craft's autosaveDrafts setting set to false, or is the owner element of a type that does not autosave drafts?

@pc-erin
Copy link

pc-erin commented Aug 16, 2024

Just for anyone else who encounters this: if it's a timing issue, you can sometimes replicate those easier by throttling your connection in the browser network tools.

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

4 participants