verbb / vizy

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

Control panel saying "Showing your unsaved changes" on opening entry #287

Closed bleepsandblops closed 2 months ago

bleepsandblops commented 3 months ago

Describe the bug

If I have a Vizy field with one block (or more) in it, the CP shows the message "Showing your unsaved changes" on opening the entry, before doing anything in it, not even focusing in the Vizy field. It shows the Vizy field with the blue border indicating that that's the field that has changed.

Cf screenshot below, I've even tried with a field that's just an UI element so literally nothing to change in it.

Screenshot 2024-03-08 at 10 11 47

Steps to reproduce

  1. Create new entry with vizy field
  2. Add a block in the field
  3. Save the entry
  4. Reopen the entry, the message appears instantly

Craft CMS version

4.8.1

Plugin version

2.1.16

Multi-site?

No

Additional context

This doesn't happen if the field is left completely empty.

bleepsandblops commented 3 months ago

Looks related to https://github.com/verbb/vizy/issues/282 but there are no nested Vizy fields here

engram-design commented 3 months ago

I can't replicate this with your exact setup I'm afraid. Does saving the entry and re-loading change the behaviour at all?

bleepsandblops commented 3 months ago

No it doesn't...

Did some more testing, I have another Vizy field with lots of blocks too, and this one doesn't exhibit that behaviour unless I add a block with a sub Vizy field (so clear case of https://github.com/verbb/vizy/issues/282).

But for the one in my screenshot, I can't really make sense of it as not even the available blocks have sub Vizy fields.

bleepsandblops commented 3 months ago

Did some more digging, if I open the entry, I immediately get that message, then if I look in the network tab I can see a call to the admin/actions/elements/save-draft action with those two lines in the payload: fields[contentPage][vizyData]: [{"type":"vizyBlock","attrs":{"id":"vizy-block-ZymZBfJ4v0","enabled":false,"collapsed":true,"values":{"type":"type-vZc30jrmgy","content":{}}}},{"type":"vizyBlock","attrs":{"id":"vizy-block-VLavpzygWv","enabled":false,"collapsed":true,"values":{"type":"type-elc8vQ9oNw","content":{}}}}] modifiedDeltaNames[]: fields[contentPage] If I save and open again, exact same content for those two lines. And if I open the content table I can also see for that field the exact same json...

So I don't understand what it thinks has changed? Anything else I can look at?

engram-design commented 2 months ago

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

engram-design commented 2 months ago

Fixed in 2.1.19