fix(content): generically prioritize primary link navigation in collection screens
This commit is contained in:
parent
b9e2821a26
commit
138085751e
|
|
@ -191,6 +191,12 @@ export function CollectionTemplateScreen({
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onItemPress={(item) => {
|
onItemPress={(item) => {
|
||||||
|
const primaryLink = item.attributes?.link;
|
||||||
|
const primaryRefs = getNavigableContentReferences(primaryLink);
|
||||||
|
if (primaryRefs.length === 1) {
|
||||||
|
router.push(buildContentReferenceRoute(primaryRefs[0]) as never);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const references = Object.values(item.attributes).flatMap((value) =>
|
const references = Object.values(item.attributes).flatMap((value) =>
|
||||||
getNavigableContentReferences(value),
|
getNavigableContentReferences(value),
|
||||||
);
|
);
|
||||||
|
|
@ -219,6 +225,12 @@ export function CollectionTemplateScreen({
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onItemPress={(item) => {
|
onItemPress={(item) => {
|
||||||
|
const primaryLink = item.attributes?.link;
|
||||||
|
const primaryRefs = getNavigableContentReferences(primaryLink);
|
||||||
|
if (primaryRefs.length === 1) {
|
||||||
|
router.push(buildContentReferenceRoute(primaryRefs[0]) as never);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const references = Object.values(item.attributes).flatMap((value) =>
|
const references = Object.values(item.attributes).flatMap((value) =>
|
||||||
getNavigableContentReferences(value),
|
getNavigableContentReferences(value),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue