cms
cms copied to clipboard
Improve handling of invalid Replicator and Bard field data
When a Replicator or Bard field contains invalid data, for example a set that has no configuration or a node for an extension that isn’t enabled, the feedback in the CP can be a little mysterious:
- Replicator fields with an invalid set will render an empty item:

- Bard fields with an invalid set will render the raw json (because the
BardSetcomponent errors):
- Bard fields with invalid nodes/marks end up with a completely blank value.
This PR aims to improve this by fixing the BardSet error, checking for invalid data, and adding invalid states (a bit like the Entries and Assets fieldtypes have):

The idea was just to give a bit of a hint about what the problem is, but more details could be added or logged to the console. Tiptap already logs errors when it runs into invalid nodes/marks.
Here is a blueprint and entry for testing invalid values: https://gist.github.com/jacksleight/8d936be1f4966ca9833cbcf52dd697ec
Fixes https://github.com/statamic/cms/issues/6143
OMG I love this one so much
thank you thank you thank you