volto icon indicating copy to clipboard operation
volto copied to clipboard

RelationChoice field ObjectBrowserWidget first selection

Open ionlizarazu opened this issue 2 years ago • 1 comments

Describe the bug The ObjectBrowserWidget gives an error when you choose the first object in a RelationChoice field

To Reproduce Steps to reproduce:

We have configured a RelationChoice field in the backend this way:

<field name="authors" type="z3c.relationfield.schema.RelationList">
  <title i18n:translate="">Authors</title>
  <description i18n:translate=""></description>
  <value_type type="z3c.relationfield.schema.RelationChoice">
    <title>Related</title>
    <portal_type>
      <element>Author</element>
    </portal_type>
  </value_type>
  <required>False</required>
  <readonly>False</readonly>
</field>

In the frontend, when we choose an object for this field, breaks in this line: https://github.com/plone/volto/blob/a03d73ac33d1a09b5531ea9bb0fdd67d7415c023/src/components/manage/Widgets/ObjectBrowserWidget.jsx#L151

Should we check if this.props.value is not null to be sure that we can spread it?

ionlizarazu avatar Jun 17 '22 08:06 ionlizarazu

Related to https://github.com/plone/volto/issues/3355 ?

arky avatar Jun 21 '22 09:06 arky

@ionlizarazu has this been fixed in #3355?

stevepiercy avatar Oct 24 '23 21:10 stevepiercy

Yes, it has been fixed. Thanks!

ionlizarazu avatar Oct 26 '23 06:10 ionlizarazu