hdoro/sanity-plugin-conditional-field

Validation markers not handled correctly

fabien opened this issue · 4 comments

Hi @hdoro thanks for this plugin, it seems to fill in a glaring gap in Sanity Studio right now.

However, it appears that it affects the display of errors within array items (objects). With a field like this:

  {
      title: 'Variants',
      name: 'variants',
      type: 'array',
      of: [
        {
          type: 'product.variant',
        },
      ],
      inputComponent: ConditionalField,
      options: {
        condition: (document) => {
          return true; // for testing
        },
      },
    }

The validation messages are not shown within the modal product.variant form anymore. They only appear top-level (document header).

Perhaps this is related to sanity-io/sanity#2468 as well?

Loved the plugin, really solved the problem I was having; but I am also not being able to display error messages in the conditional fields, the validation itself works but the message and red background doesnt' show.

hdoro commented

V1 hopefully fixes this. Let me know if otherwise, Fabien, and thanks for reporting!

@hdoro I will have to check, thanks for working on this!

@hdoro I was able to install this new version. However, there seems to be a bug that affects the margins between items:

While the custom price section is hidden, it is fine:

image

However, when the section is no longer hidden:

image

This is inside of a popover at the moment. If I close it, and reopen the popover, it's fine. The same happens to fields within a fieldset elsewhere in a document (normal layout flow).

It appears to be related to the new HiddenField code and within a fieldset. I'm running Sanity 2.13.0 btw.