verbb / vizy

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

Localized fields within a non-localized Vizy block get overwritten on "Apply draft" #98

Closed sidedwards closed 2 years ago

sidedwards commented 2 years ago

πŸ› Bug description

As the title states, when Vizy is set up as "non-translatable", localized (i.e. translatable") fields within store their values globally basis v.s per-site and content in other sites get overwritten content on save.

Additional info

πŸ‘£ Reproduction steps

Steps to reproduce the behavior:

  1. Set up Craft for multi-site.
  2. Create a Section and set the "Propagation method" to "Save entries to all sites enabled for this section".
  3. Create a new Vizy field with the "Translation method" set to "Not translatable".
  4. Add localized fields to the new Vizy field.
  5. Create a new entry and add content to the localized Vizy fields.
  6. Open a new draft for the Entry in another site/language, update the content within the localized fields, and apply the draft.
  7. Switch back to the original site/language and see the error. Localized content from the target site draft overwrites the original content.

πŸ¦„ Expected behavior

Localized fields within non-localized Vizy blocks should store their values on a per-site basis v.s globally.

🐴 Actual behavior

Localized fields within non-localized Vizy blocks store their content across all sites.

πŸ“š Resources

https://user-images.githubusercontent.com/11489608/152849074-d727bea2-78fd-4c1b-bdd6-78a163ccde58.mp4

engram-design commented 2 years ago

This was a tricky one, due to how Craft propagates content. It assumes that if the Vizy field isn't translated, then the content should all be the same. Even though Matrix is in a similar situation to Vizy, it's much less complicated due to each block being an element - something Vizy isn't (for performance, and part of the whole deal). As such, we need to handle the inner content consolidation and propagation ourselves.

Fixed for the next release. To get the fix early, change your verbb/vizy requirement in composer.json to:

"require": {
  "verbb/vizy": "dev-craft-3 as 1.0.9",
  "...": "..."
}

Then run composer update.

engram-design commented 2 years ago

Fixed in 1.0.10