Skip to content

Commit b7eb4c9

Browse files
committed
Handle null/undefined values in content and view selector
1 parent 6ede066 commit b7eb4c9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

xp-archive/client/content/Content.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ export const Content = () => {
5555
<div className={style.content}>
5656
<div className={style.top}>
5757
<div>
58-
<Detail spacing>{data?.json._path}</Detail>
58+
<Detail spacing>{data?.json._path ?? ''}</Detail>
5959
<Heading size={'medium'} level={'2'} spacing>
60-
{data?.json.displayName}
60+
{data?.json.displayName ?? ''}
6161
</Heading>
6262
<ViewSelector
6363
selectedView={selectedView}

xp-archive/client/viewSelector/ViewSelector.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ export const ViewSelector = ({
3939

4040
const relevantViewVariants = getRelevantViewVariants(isWebpage, hasAttachment);
4141

42+
if (relevantViewVariants.length === 0) {
43+
return null;
44+
}
45+
4246
return (
4347
<ToggleGroup
4448
className={style.datatheme}

0 commit comments

Comments
 (0)