Skip to content

Commit

Permalink
fix: gracefully handle unknown product codes
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarajohn committed May 16, 2024
1 parent 367f50a commit 7a6b3fd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ui/Navigation/components/GlobalNav/GlobalNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,14 @@ function GlobalNav(props: GlobalNavProps) {
{orfiumProducts
? orfiumProducts.map((p) => {
const isCurrentApp = p.client_metadata.product_code === config.productCode;
const Icon = productIconsDict[p.client_metadata.product_code];
const Icon: (() => ReactElement) | undefined =
productIconsDict[p.client_metadata.product_code];

if (!Icon) {
console.warn('Unknown product code: ', p.client_metadata.product_code);

return null;
}

// TODO: We could be using the provided `p.icon_url` and not have to keep our own
// dictionary of product codes and icons, but that would need changes on the CSP side
Expand Down

0 comments on commit 7a6b3fd

Please sign in to comment.