Skip to content

Commit

Permalink
Fix bug with subject number showing on all results
Browse files Browse the repository at this point in the history
The wrong object (work) was passed to materialIsFiction(). The
bestRepresentation manifestation has the information.
  • Loading branch information
spaceo committed Sep 28, 2023
1 parent 0caae03 commit 918b297
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ const CardListItem: React.FC<CardListItemProps> = ({
titles: { full: fullTitle },
series,
creators,
manifestations: {
all: manifestations,
bestRepresentation: { shelfmark }
},
manifestations: { all: manifestations, bestRepresentation },
workId
},
coverTint,
Expand All @@ -79,7 +76,7 @@ const CardListItem: React.FC<CardListItemProps> = ({
materialTypeFromFilters
);
const languageIsoCode = getManifestationLanguageIsoCode(manifestations);

const { shelfmark } = bestRepresentation;
const { track } = useStatistics();
// We use hasBeenVisible to determine if the search result
// is, or has been, visible in the viewport.
Expand Down Expand Up @@ -163,7 +160,7 @@ const CardListItem: React.FC<CardListItemProps> = ({
)}
</div>

{!materialIsFiction(item) && shelfmark && (
{!materialIsFiction(bestRepresentation) && shelfmark && (
<SubjectNumber
className="text-tags color-secondary-gray mt-8"
shelfmark={shelfmark}
Expand Down

0 comments on commit 918b297

Please sign in to comment.