Skip to content

Commit

Permalink
fix: edit crash additionalInformation undefined (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
Abrom8 authored Oct 10, 2024
1 parent 767954c commit b3dc472
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/components/@shared/AssetList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ const columns: TableOceanColumn<AssetExtended>[] = [
return (
<AssetType
className={styles.typeLabel}
type={metadata.additionalInformation.saas ? 'saas' : metadata.type}
accessType={metadata.additionalInformation.saas ? 'saas' : accessType}
type={metadata?.additionalInformation?.saas ? 'saas' : metadata.type}
accessType={
metadata?.additionalInformation?.saas ? 'saas' : accessType
}
/>
)
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/@shared/AssetTeaser/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export default function AssetTeaser({
<aside className={styles.detailLine}>
<AssetType
className={styles.typeLabel}
type={asset.metadata.additionalInformation?.saas ? 'saas' : type}
type={asset?.metadata?.additionalInformation?.saas ? 'saas' : type}
accessType={
asset.metadata.additionalInformation?.saas ? 'saas' : accessType
asset?.metadata?.additionalInformation?.saas ? 'saas' : accessType
}
/>
<span className={styles.typeLabel}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Asset/Edit/DebugEditMetadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function DebugEditMetadata({
values.links[0].valid && [sanitizeUrl(values.links[0].url)]
const saasDetails =
values.files[0].type === 'hidden'
? asset.metadata.additionalInformation.saas
? asset?.metadata?.additionalInformation?.saas
: values.files[0].type === 'saas'
? {
redirectUrl: sanitizeUrl(values.files[0].url),
Expand All @@ -46,7 +46,7 @@ export default function DebugEditMetadata({

const showSaas =
(values.files[0].type === 'hidden' &&
asset.metadata.additionalInformation.saas) ||
asset?.metadata?.additionalInformation?.saas) ||
values.files[0].type === 'saas'
if (!showSaas) delete newMetadata.additionalInformation.saas

Expand Down
2 changes: 1 addition & 1 deletion src/components/Asset/Edit/_constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function getInitialValues(
?.termsAndConditions || [{ url: '' }]
},
license: metadata?.license,
saas: metadata.additionalInformation.saas || {}
saas: metadata?.additionalInformation?.saas || {}
}
}

Expand Down

0 comments on commit b3dc472

Please sign in to comment.