fix(build): build error caused by non-exsisting readme
This commit is contained in:
parent
34c949d43f
commit
f2ceda77aa
|
|
@ -61,15 +61,21 @@ function CardCategory({item}) {
|
||||||
if (!href) {
|
if (!href) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const docId = href.substring(6) + 'README';
|
const ReadMeSubfix = href.endsWith('/') ? 'README' : '/README';
|
||||||
const doc = useDocById(docId ?? undefined);
|
const docId = href.substring(6) + ReadMeSubfix;
|
||||||
|
let doc;
|
||||||
|
try {
|
||||||
|
doc = useDocById(docId ?? undefined);
|
||||||
|
} catch (e) {
|
||||||
|
doc = null;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<CardLayout
|
<CardLayout
|
||||||
className={item.className}
|
className={item.className}
|
||||||
href={href}
|
href={href}
|
||||||
icon="🗃️"
|
icon="🗃️"
|
||||||
title={item.label}
|
title={item.label}
|
||||||
description={item.description ?? doc.description ?? categoryItemsPlural(item.items.length)}
|
description={item.description ?? doc?.description ?? categoryItemsPlural(item.items.length)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue