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

[5.x]: Field values are lost in an inline-editable nested entry, if the owner entry is saved multiple times without allowing the auto-save to trigger #15190

Closed
mmikkel opened this issue Jun 13, 2024 · 2 comments
Assignees
Labels

Comments

@mmikkel
Copy link
Contributor

mmikkel commented Jun 13, 2024

What happened?

Description

Field values in inline-editable Matrix entries are sometimes lost, in cases where the owner entry is attempted saved multiple times without allowing the draft auto-save to trigger.

This bug is a bit flaky and is possibly difficult to reproduce, but here's a screencast and some steps (that involves provoking a validation error) to hopefully make it easier to replicate:

CleanShot.2024-06-13.at.02.17.45.mp4

FWIW, I've only seen this happen in inline-editable Matrix fields and have tried, but failed to reproduce in other types of field layouts.

Steps to reproduce

  1. Create an inline-editable Matrix field with an entry type that has two PlainText fields. Make one of the fields required.
  2. Create a new nested entry in the Matrix field. Enter a value in the field that isn't required, and leave the required field blank. Type quickly, and then quickly save the owner entry using the Cmd+S shortcut, before the auto-save has a chance to trigger.
  3. Observe the validation error for the required field. The non-required field should still have a value at this point.
  4. Enter a value in the required field. Again, type quickly and then quickly save the owner entry again using the Cmd+S shortcut, before the auto-save has a chance to trigger.
  5. Observe that the owner entry has been successfully saved, but now the non-required field is blank.

Expected behavior

Entered field values should always be retained when saving the owner entry, regardless of whether or not the draft auto-save has had a chance to trigger.

Actual behavior

Moving too fast can cause Craft to empty out fields in nested Matrix entries when saving the owner entry.

Craft CMS version

5.2.0

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

None

@mmikkel mmikkel added the bug label Jun 13, 2024
@brandonkelly brandonkelly self-assigned this Jun 13, 2024
@brandonkelly
Copy link
Member

Thanks for reporting that! I was able to reproduce in Craft 4 as well, for blocks that already existed before page load. Fixed for the next releases.

@brandonkelly
Copy link
Member

Craft 4.10.1 and 5.2.1 are out with that fix. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants