From 920f2e51da95d803f80e8a0578d096eb432a0b57 Mon Sep 17 00:00:00 2001 From: Max Kless Date: Wed, 17 Apr 2024 11:43:49 +0200 Subject: [PATCH] fix(graph): prevent missing sourceMaps errors in graph app by using ?.startsWith --- .../target-configuration-details.util.ts | 2 +- graph/ui-tooltips/src/lib/sourcemap-info-tooltip.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/graph/ui-project-details/src/lib/target-configuration-details/target-configuration-details.util.ts b/graph/ui-project-details/src/lib/target-configuration-details/target-configuration-details.util.ts index 268c7337c78c7..edc3219c082c9 100644 --- a/graph/ui-project-details/src/lib/target-configuration-details/target-configuration-details.util.ts +++ b/graph/ui-project-details/src/lib/target-configuration-details/target-configuration-details.util.ts @@ -11,7 +11,7 @@ export function selectSourceInfo( // When the key is a prefix of the filter, we can record it as the root source. // Use the most specific key for the root "." source value. // e.g. `targets.build` takes precedence over `targets` - if (!rootKey || key.startsWith(rootKey)) { + if (!rootKey || key?.startsWith(rootKey)) { rootKey = key; rootSource = value; } diff --git a/graph/ui-tooltips/src/lib/sourcemap-info-tooltip.tsx b/graph/ui-tooltips/src/lib/sourcemap-info-tooltip.tsx index b83d32a829c08..3d44c2c490b69 100644 --- a/graph/ui-tooltips/src/lib/sourcemap-info-tooltip.tsx +++ b/graph/ui-tooltips/src/lib/sourcemap-info-tooltip.tsx @@ -20,7 +20,7 @@ export function SourcemapInfoToolTip({ // Every other property within in the target has the form `target.${targetName}.${propertyName} const isTarget = propertyKey.split('.').length === 2; - const docsUrlSlug: string | undefined = plugin.startsWith('@nx/') + const docsUrlSlug: string | undefined = plugin?.startsWith('@nx/') ? plugin.replace('@nx/', '').split('/')[0] : undefined;