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

[3.x]: Autosave Merge Issues with Localized Fields #11466

Closed
sidedwards opened this issue Jun 20, 2022 · 8 comments
Closed

[3.x]: Autosave Merge Issues with Localized Fields #11466

sidedwards opened this issue Jun 20, 2022 · 8 comments

Comments

@sidedwards
Copy link
Contributor

sidedwards commented Jun 20, 2022

What happened?

🐛 Bug description

When "Autosave" is enabled, localized blocks and fields often get reverted or duplicated when applying drafts after the current Entry is unintentionally autosaved.

In both instances, clicking "Discard changes" seems to correct the issue.

👣 Reproduction steps

Demo 1

  1. Given an Entry with localized Matrix blocks, click "Create a draft"
  2. Remove the localized blocks and add two new blocks
  3. Click "Save draft"
  4. Open the original Entry and click on a field while the page is loading to trigger the draft autosave
  5. Open up the recently created draft and click "Apply draft"
  6. See error. Localized blocks from both the draft and original Entry are present

Demo 2

  1. Given an Entry with localized Matrix blocks, click "Create a draft"
  2. Update the values within the existing localized blocks
  3. Click "Save draft"
  4. Open the original Entry and click on a field while the page is loading to trigger the draft autosave
  5. Open up the recently created draft and click "Apply draft"
  6. See error. The localized fields from the draft are reverted to their original values even though no changes were made in the current Entry.

📚 Resources

Demo 1

CleanShot.2022-06-20.at.16.32.03.mp4

Demo 2

CleanShot.2022-06-20.at.16.57.34.mp4

🔗 References

Craft CMS version

3.7.44

@brandonkelly
Copy link
Member

I’m seeing two issues here, which are probably related.

  1. When you go back to the “Current” revision, a provisional draft should not be getting autosaved just by clicking on the form. Drafts are only autosaved when a form value has actually changed.
  2. The provisional draft is showing that all fields have been edited (the blue lines), when none of their values should have changed.

Can you try disabling your Grammarly browser extension, and see if those issues persist?

@sidedwards
Copy link
Contributor Author

Hey @brandonkelly, thanks for the quick response. I disabled Grammarly and tested again.

  1. I noticed that autosave is triggered if you click within the form before the page is completely loaded. The example below has the propagation method "Save entries to all sites enabled" and a localized plain text field.
  2. I noticed the same, but I'm not sure what is causing that issue.

Let me know if there is any other information that I can provide to help debug.

📚 Resources

CleanShot.2022-06-22.at.14.42.02.mp4

@brandonkelly
Copy link
Member

Is “Localized Plain Text” a Vizy field by chance?

@sidedwards
Copy link
Contributor Author

Nope, just a standard text field. Although, I also noticed that Vizy would trigger an autosave without clicking into any fields.

I also tested without the localized plain text and could still trigger the autosave by clicking on the localized "Title" field before the page finished loading.

📚 Resources

CleanShot.2022-06-22.at.15.30.08.mp4

@brandonkelly
Copy link
Member

If you disable Vizy (even though it’s not in use) does this still occur?

@sidedwards
Copy link
Contributor Author

@brandonkelly, yes, I was able to repro with Vizy disabled.

@brandonkelly
Copy link
Member

Managed to reproduce, and just released Craft 3.7.45.1 and 4.0.5.1 with a fix.

@sidedwards
Copy link
Contributor Author

Awesome, thanks @brandonkelly 🙌

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

2 participants