statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
3.69k stars 508 forks source link

Bard inside replicator HTML set previews render raw JSON #10244

Open jacksleight opened 3 months ago

jacksleight commented 3 months ago

Bug description

If you have a bard field with a set that has an assets field, and that bard field is inside a replicator, the asset preview will render raw JSON instead of the image:

Screenshot 2024-05-31 at 17 14 30

I tried to fix it, and traced the issue to the value instanceof PreviewHtml check in ManagesPreviewText.js. For some reason the object is ending up as a plain object not a PreviewHtml object, so the check fails. But I couldn't figure where that was happening.

This does not happen with replicators/bard fields at the top level.

How to reproduce

  1. Create a replicator
  2. Add a set
  3. Create a bard field in that set
  4. Add a set
  5. Add an assets field
  6. Set an asset
  7. Collapse the set

Logs

No response

Environment

Statamic
Addons: 0
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.6.2

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

wuifdesign commented 4 weeks ago

Having the same problem. would be nice to have this fixed :)