verbb / vizy

A flexible visual editor for Craft CMS
Other
43 stars 8 forks source link

Nested Vizy fields causing unsaved changes #282

Closed d-karstens closed 2 months ago

d-karstens commented 4 months ago

Describe the bug

Hi,

We've been encountering an issue with Craft creating an automatic draft every time and entry is visited, even before any changes are made

It seems to be happening with nested Vizy fields, similar to https://github.com/verbb/vizy/issues/114 - on a fresh Craft install it's happening consistently with a single nested field

I took a short screen recording demonstrating it happening after saving and entry and returning to it, or when hitting "Discard" with a nested Vizy field, but not a regular text field

https://github.com/verbb/vizy/assets/21274925/3677d356-044c-431a-b692-a916aca860b0

This has been causing some of our clients to have issues where stale content is saved to their drafts without them realizing, and them accidentally overwriting updated content

Let me know if you need any more details

Steps to reproduce

  1. Create a Vizy field with another Vizy field nested inside
  2. Entry has a draft created straight away

Craft CMS version

4.7.2.1

Plugin version

2.1.15

Multi-site?

No

Additional context

Unsure if it's worth noting, but on a live site where clients have had an issue with this it seems to only be happening when there are two or more of the same nested Vizy field

engram-design commented 4 months ago

Nested Vizy fields are particularly tricky to deal with on this front, as the content does in fact change very slightly from what's stored in the database to when it's rendered (multiple times) in the Vizy field. We are supposed to be addressing this, but I'll take another look to reproduce this one.

d-karstens commented 4 months ago

Thanks, appreciate that! Let me know if you need any more details from affected databases where it's happening consistently

bleepsandblops commented 2 months ago

This is getting quite critical for us, client is starting to lose faith in the back-end.

Also it means that when they click on 'view' to get the URL, it gives them a URL with a preview token instead, which they don't want.

Thank you!

hatzipanis commented 2 months ago

This is also impacting us, and causing quite a bit of confusion on the client side. Thanks for looking into it!

engram-design commented 2 months ago

Fortunately, I can replicate this. It's mostly down to the nested structure of Vizy fields and blocks, and it's somewhat unavoidable. However, we can certainly add a check on whether the field is interacted with first, which I think will address the vast majority of issues with this (loading the page and a page is triggered when nothing happens).

This will mean that when you interact (click) on a nested Vizy block or field, the changes may be triggered, but that's a lot better than on-load, which I agree is very frustrating.

Fixed for the next release. To get this early, run composer require verbb/vizy:"dev-craft-4 as 2.1.18".

hatzipanis commented 2 months ago

Ty @engram-design!

engram-design commented 2 months ago

Fixed in 2.1.19