huridocs / uwazi

Uwazi is a web-based, open-source solution for building and sharing document collections
http://www.uwazi.io
MIT License
242 stars 80 forks source link

EntitySection component breaks entity custom pages #6660

Closed meegido closed 7 months ago

meegido commented 7 months ago

Describe the bug When the EntitySection component prepares the data to access the label of a markdown, the entity custom page is broken.

Expected behavior The EntitySection component shows the content it holds and doesn't break the entity page.

Device (please select all that apply)

Browser What browser where you using (Firefox, Chrome, Safari, etc...).

Additional context This is time-sensitive as we need this component working for a page design delivery shortly.

Zasa-san commented 7 months ago

@mfacar discovered that EntitySection and EntityData were failing for a particular tenant because for certain entities the metadata field was missing.

In this particular case the tenant has entity view pages that use EntitySection and EntityData to display relationships fields. For a reason we could not debug, some entities had this relationship metadata field missing. When the components mentioned above tried to access the property several errors happened due to them attempting to access an empty metadata field. This would be akin to the user writing the wrong property name when creating the entity view page, there's nothing to access in the metadata.

This was promptly fixed by saving the entity without modifying anything, which created the missing metadata field with a [] value, fixing the problems described in the issue.

We believe that this could have been caused by the related entity being deleted, or the templates being modified after the entity was created.

At any rate, this instance should not have issues anymore with the pages. @meegido

Zasa-san commented 7 months ago

The specific error on EntitySection will be fixed by #6661

I’m closing this issue in favor of #6568