Skip to content

Bard inside replicator HTML set previews render raw JSON #10244

@jacksleight

Description

@jacksleight

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions