verbb / vizy

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

Vizy field is hidden / disappeared when changing entry type - timeout too quick? #167

Closed bleepsandblops closed 1 year ago

bleepsandblops commented 1 year ago

Describe the bug

If I create a new entry for which the default entry type does not have a Vizy field, then switch the entry type to one that does have a Vizy field, the Vizy field is hidden:

Screenshot 2022-08-06 at 22 42 21

and in the console I see this:

Screenshot 2022-08-06 at 22 42 44

which refers to this line: setTimeout(function() { new Craft.Vizy.Input("fields-contentVizy", "fields[contentVizy]"); }, 200);

If I then manually run that line in the console it works and the field appears! So this makes me think this timeout is a bit dodgy and is too short.

Steps to reproduce

  1. Have a section with two entry types, the default one being one without a Vizy field, the other one with one
  2. Create a new entry, then swap the entry type to the type that has a Vizy field
  3. The field does not appear

Craft CMS version

4.2.0.2

Plugin version

2.0.4

Multi-site?

No

Additional context

If I open the entry after, the field is displaying correctly.

engram-design commented 1 year ago

Yep, setTimeout was always a dodgy stop-gap. Fixed for the next release. To get this fix early, change your verbb/vizy requirement in composer.json to:

"require": {
  "verbb/vizy": "dev-craft-4 as 2.0.4",
  "...": "..."
}

Then run composer update.

bleepsandblops commented 1 year ago

Thanks for your quick reaction @engram-design that seems fine now!

engram-design commented 1 year ago

Fixed in 2.0.5