Skip to content

Commit f71fef2

Browse files
committed
fix(item): add info on unreachable items
1 parent 9ecd207 commit f71fef2

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

clients/web/src/common/api/derivers/item.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,12 @@ export function deriveItemData({
202202
}) {
203203
return {
204204
...item,
205+
savedId: node?.savedId || false,
205206
authors: item?.preview?.authors || itemEnrichment?.authors || item?.authors || false,
206207
title: title({ item, itemEnrichment, node }),
207208
thumbnail: thumbnail({ item, itemEnrichment }),
208209
excerpt: excerpt({ item, itemEnrichment }),
209-
publisher: publisher({ item, itemEnrichment, passedPublisher }),
210+
publisher: publisher({ item, itemEnrichment, passedPublisher, node }),
210211
publisherLogo: item?.domainMetadata?.logo || false,
211212
externalUrl: externalUrl({ item, itemEnrichment, utmId }),
212213
// Temporary fix for the share modal and other possible areas that need the external url
@@ -278,8 +279,8 @@ function thumbnail({ item, itemEnrichment }) {
278279
* @param {object} item An item returned from the server
279280
* @returns {string} The best text to display as the publisher of this item
280281
*/
281-
function publisher({ item, itemEnrichment, passedPublisher }) {
282-
const urlToUse = item?.givenUrl || item?.resolvedUrl
282+
function publisher({ item, itemEnrichment, passedPublisher, node }) {
283+
const urlToUse = item?.givenUrl || item?.resolvedUrl || node?.url
283284
const derivedDomain = domainForUrl(urlToUse)
284285
const syndicatedPublisher = item?.syndicatedArticle?.publisher?.name
285286
//prettier-ignore

clients/web/src/common/api/fragments/fragment.savedItem.js

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ export const FRAGMENT_SAVED_ITEM = gql`
44
fragment SavedItemDetails on SavedItem {
55
_createdAt
66
_updatedAt
7+
title
8+
url
79
savedId: id
810
status
911
isFavorite

clients/web/src/common/api/queries/get-corpus-search.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function handleResponse(response) {
6565

6666
function getItemsByIdFromEdges(edges) {
6767
return edges.reduce((previous, current) => {
68-
if (!current?.node?.item?.preview?.id) return previous
68+
if (!current?.node?.item?.preview?.previewId) return previous
6969

7070
const { item, searchHighlights } = deriveCorpusPreview(current)
7171
return {

0 commit comments

Comments
 (0)