Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(catalogue): resource details page not rendering when resource.peopleInvolved is empty #4347

Merged
merged 3 commits into from
Oct 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ const tocItems = computed(() => {
id: "Organisations",
});
}
if (contributors.value) {
if (peopleInvolvedSortedByRoleAndName.value) {
tableOffContents.push({
label: "Contributors",
id: "Contributors",
Expand Down Expand Up @@ -508,8 +508,8 @@ if (route.params.catalogue) {
] = `/${route.params.schema}/ssr-catalogue/all/${resourceType.path}`;
}

const contributors = computed(() =>
resource.value.peopleInvolved.sort((a, b) => {
const peopleInvolvedSortedByRoleAndName = computed(() =>
resource.value.peopleInvolved?.sort((a, b) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if peopleInvolved is falsy, the value of the contributors becomes undefined , whereas i would expect an empty list.

also is contributors now 'peopleInvolvedSoretedByRoleAndName' ?

Copy link
Member Author

@mswertz mswertz Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would you expect empty list? I mean, the list should not be there if there are no values? See line 599 where the content block is conditional. That could instead be conditional on length > 0 is that better?

I will indeed rename the contributors to be more meaningful as you suggest

(and we should discuss with catalogue team if it should be 'contributors' or 'people involved'

const minimumOrderOfRolesA = a.role?.length
? Math.min(...a.role?.map((role) => role.order ?? Infinity))
: Infinity;
Expand Down Expand Up @@ -599,10 +599,10 @@ const showPopulation = computed(
></ContentBlockOrganisations>

<ContentBlockContact
v-if="contributors"
v-if="peopleInvolvedSortedByRoleAndName"
id="Contributors"
title="Contributors"
:contributors="contributors"
:contributors="peopleInvolvedSortedByRoleAndName"
>
</ContentBlockContact>

Expand Down