From 3d7560585f14a8b5b0a9dd9d393f0643e1f59d58 Mon Sep 17 00:00:00 2001 From: Aseem Bansal Date: Thu, 12 Dec 2024 20:49:25 +0530 Subject: [PATCH] fix(ui): dereference errors (#12034) --- datahub-web-react/src/App.tsx | 2 +- datahub-web-react/src/app/AdminConsole.tsx | 4 ++-- .../components/AnalyticsPage.tsx | 4 ++-- .../nestedDomains/domainNavigator/DomainNode.tsx | 2 +- .../src/app/embed/lookup/useGetEntityByUrl.ts | 2 +- .../profile/BusinessAttributeRelatedEntity.tsx | 2 +- .../src/app/entity/chart/ChartEntity.tsx | 6 +++--- .../src/app/entity/dashboard/DashboardEntity.tsx | 6 +++--- .../src/app/entity/dataFlow/DataFlowEntity.tsx | 2 +- .../src/app/entity/dataJob/DataJobEntity.tsx | 2 +- .../src/app/entity/dataJob/tabs/RunsTab.tsx | 4 ++-- .../src/app/entity/dataset/DatasetEntity.tsx | 2 +- .../app/entity/dataset/profile/OperationsTab.tsx | 4 ++-- .../profile/schema/utils/schemaTitleRenderer.tsx | 2 +- .../entity/dataset/profile/schema/utils/utils.ts | 2 +- .../domain/DataProductsTab/DataProductsTab.tsx | 2 +- .../profile/AddRelatedTermsModal.tsx | 5 ++++- .../profile/GlossaryRelatedEntity.tsx | 2 +- .../entity/mlFeatureTable/profile/Sources.tsx | 4 ++-- .../mlModel/profile/MlModelFeaturesTab.tsx | 2 +- .../src/app/entity/ownership/OwnershipList.tsx | 2 +- .../shared/EntityDropdown/DomainParentSelect.tsx | 2 +- .../shared/EntityDropdown/NodeParentSelect.tsx | 2 +- .../useHandleMoveDomainComplete.ts | 2 +- .../shared/__tests__/siblingsUtils.test.ts | 8 ++++---- .../CreateERModelRelationModal.tsx | 4 ++-- .../ERModelRelationship/ERModelRelationUtils.tsx | 2 +- .../styled/ERModelRelationship/EditableCell.tsx | 2 +- .../profile/nav/ProfileNavBrowsePathV2.tsx | 2 +- .../sidebar/DataProduct/SetDataProductModal.tsx | 2 +- .../profile/sidebar/FormInfo/useGetPromptInfo.ts | 4 ++-- .../containers/profile/sidebar/FormInfo/utils.ts | 6 +++--- .../entity/shared/containers/profile/utils.ts | 2 +- .../embed/UpstreamHealth/FailingAssertions.tsx | 2 +- .../entity/shared/embed/UpstreamHealth/utils.ts | 2 +- .../entityForm/EntityFormContextProvider.tsx | 2 +- .../src/app/entity/shared/entityForm/Form.tsx | 4 ++-- .../prompts/StructuredPropertyPrompt/utils.ts | 2 +- .../schemaFieldPrompts/SchemaFieldPrompts.tsx | 2 +- .../useShouldShowVerificationPrompt.ts | 2 +- .../tabs/Dataset/AccessManagement/utils.tsx | 4 ++-- .../shared/tabs/Dataset/Schema/SchemaTable.tsx | 2 +- .../Schema/components/ForeignKeyLabel.tsx | 2 +- .../Schema/components/PropertyTypeLabel.tsx | 4 ++-- .../SchemaFieldDrawer/FieldProperties.tsx | 2 +- .../SchemaFieldDrawer/SchemaFieldDrawer.tsx | 2 +- .../Schema/utils/useDescriptionRenderer.tsx | 2 +- .../Schema/utils/useTagsAndTermsRenderer.tsx | 2 +- .../useTagsAndTermsRendererFeatureTable.tsx | 2 +- .../Validations/DatasetAssertionDetails.tsx | 2 +- .../contract/FreshnessScheduleSummary.tsx | 2 +- .../Validations/contract/builder/utils.ts | 4 ++-- .../shared/tabs/Entity/ChartDashboardsTab.tsx | 2 +- .../shared/tabs/Entity/DashboardChartsTab.tsx | 2 +- .../shared/tabs/Entity/DashboardDatasetsTab.tsx | 2 +- .../shared/tabs/Entity/DataFlowJobsTab.tsx | 2 +- .../weaklyTypedAspects/DynamicPropertiesTab.tsx | 2 +- .../Incident/components/IncidentListItem.tsx | 8 ++++---- .../shared/tabs/Lineage/ColumnLineageSelect.tsx | 2 +- ...wnloadScrollAcrossLineageSearchResultsHook.ts | 14 +++++++------- .../shared/tabs/ML/MlFeatureFeatureTableTab.tsx | 2 +- .../tabs/ML/MlPrimaryKeyFeatureTableTab.tsx | 2 +- .../shared/tabs/Properties/Edit/EditColumn.tsx | 2 +- .../Edit/EditStructuredPropertyModal.tsx | 2 +- .../entity/shared/tabs/Properties/NameColumn.tsx | 2 +- .../shared/tabs/Properties/ValuesColumn.tsx | 2 +- .../src/app/entity/user/UserProfile.tsx | 4 ++-- .../src/app/entity/view/builder/ViewBuilder.tsx | 4 +++- datahub-web-react/src/app/entity/view/utils.ts | 2 +- .../src/app/glossary/BusinessGlossaryPage.tsx | 4 ++-- .../app/glossary/GlossaryBrowser/NodeItem.tsx | 2 +- .../src/app/glossary/__tests__/utils.test.ts | 2 +- datahub-web-react/src/app/glossary/utils.ts | 4 ++-- .../src/app/home/HomePageHeader.tsx | 2 +- .../src/app/ingest/ManageIngestionPage.tsx | 2 +- .../app/ingest/source/IngestionSourceList.tsx | 4 ++-- .../app/ingest/source/IngestionSourceTable.tsx | 12 ++++++------ .../source/builder/RecipeForm/RecipeForm.tsx | 2 +- .../RecipeForm/SecretField/SecretField.tsx | 2 +- .../TestConnection/TestConnectionModal.tsx | 6 +++--- .../executions/IngestionSourceExecutionList.tsx | 2 +- .../src/app/lineage/LineageEntityColumns.tsx | 2 +- .../src/app/lineage/LineageExplorer.tsx | 2 +- .../src/app/lineage/manage/AddEntityEdge.tsx | 2 +- .../src/app/lineage/utils/columnLineageUtils.ts | 2 +- .../src/app/lineage/utils/layoutTree.ts | 16 ++++++++-------- .../app/permissions/policy/PolicyActorForm.tsx | 2 +- .../src/app/permissions/roles/ManageRoles.tsx | 6 +++--- .../app/permissions/roles/RoleDetailsModal.tsx | 4 ++-- .../search/AdvancedFilterSelectValueModal.tsx | 12 ++++++------ datahub-web-react/src/app/search/SearchBar.tsx | 2 +- .../src/app/search/filters/utils.tsx | 2 +- .../app/search/sidebar/useBrowsePagination.tsx | 2 +- ...eDownloadScrollAcrossEntitiesSearchResults.ts | 4 ++-- .../src/app/settings/AccessTokens.tsx | 4 ++-- .../src/app/settings/SettingsPage.tsx | 6 +++--- .../src/app/shared/admin/HeaderLinks.tsx | 4 ++-- .../AddBusinessAttributeModal.tsx | 2 +- .../src/app/shared/tags/AddTagsTermsModal.tsx | 2 +- .../src/providers/EducationStepsProvider.tsx | 2 +- 100 files changed, 165 insertions(+), 160 deletions(-) diff --git a/datahub-web-react/src/App.tsx b/datahub-web-react/src/App.tsx index 2fdd7c8ed68004..81f137417f1f8a 100644 --- a/datahub-web-react/src/App.tsx +++ b/datahub-web-react/src/App.tsx @@ -79,7 +79,7 @@ export const InnerApp: React.VFC = () => { - {useCustomTheme().theme?.content.title} + {useCustomTheme().theme?.content?.title} diff --git a/datahub-web-react/src/app/AdminConsole.tsx b/datahub-web-react/src/app/AdminConsole.tsx index f6395a3bd3cb8a..a79575c3d88d78 100644 --- a/datahub-web-react/src/app/AdminConsole.tsx +++ b/datahub-web-react/src/app/AdminConsole.tsx @@ -37,8 +37,8 @@ export const AdminConsole = (): JSX.Element => { const [adminConsoleOpen, setAdminConsoleOpen] = useState(false); const { config } = useAppConfig(); - const isAnalyticsEnabled = config?.analyticsConfig.enabled; - const isPoliciesEnabled = config?.policiesConfig.enabled; + const isAnalyticsEnabled = config?.analyticsConfig?.enabled; + const isPoliciesEnabled = config?.policiesConfig?.enabled; const showAnalytics = (isAnalyticsEnabled && me && me?.platformPrivileges?.viewAnalytics) || false; const showPolicyBuilder = (isPoliciesEnabled && me && me?.platformPrivileges?.managePolicies) || false; diff --git a/datahub-web-react/src/app/analyticsDashboard/components/AnalyticsPage.tsx b/datahub-web-react/src/app/analyticsDashboard/components/AnalyticsPage.tsx index bf0e5af2427bbb..f139ef7368a74d 100644 --- a/datahub-web-react/src/app/analyticsDashboard/components/AnalyticsPage.tsx +++ b/datahub-web-react/src/app/analyticsDashboard/components/AnalyticsPage.tsx @@ -121,11 +121,11 @@ export const AnalyticsPage = () => { placeholder="Select a domain" onChange={onDomainChange} filterOption={(input, option) => - option?.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 + option?.children?.toLowerCase()?.indexOf(input.toLowerCase()) >= 0 } > All - {domainData?.listDomains?.domains.map((domainChoice) => ( + {domainData?.listDomains?.domains?.map((domainChoice) => ( {domainChoice?.properties?.name} diff --git a/datahub-web-react/src/app/domain/nestedDomains/domainNavigator/DomainNode.tsx b/datahub-web-react/src/app/domain/nestedDomains/domainNavigator/DomainNode.tsx index bf70bd043fd4a1..82977eff4f95bc 100644 --- a/datahub-web-react/src/app/domain/nestedDomains/domainNavigator/DomainNode.tsx +++ b/datahub-web-react/src/app/domain/nestedDomains/domainNavigator/DomainNode.tsx @@ -83,7 +83,7 @@ export default function DomainNode({ domain, numDomainChildren, domainUrnToHide, const hasDomainChildren = useHasDomainChildren({ domainUrn: domain.urn, numDomainChildren }); const shouldAutoOpen = useMemo( - () => !isInSelectMode && entityData?.parentDomains?.domains.some((parent) => parent.urn === domain.urn), + () => !isInSelectMode && entityData?.parentDomains?.domains?.some((parent) => parent.urn === domain.urn), [isInSelectMode, entityData, domain.urn], ); diff --git a/datahub-web-react/src/app/embed/lookup/useGetEntityByUrl.ts b/datahub-web-react/src/app/embed/lookup/useGetEntityByUrl.ts index f11a3a02b43448..49136c39fd2424 100644 --- a/datahub-web-react/src/app/embed/lookup/useGetEntityByUrl.ts +++ b/datahub-web-react/src/app/embed/lookup/useGetEntityByUrl.ts @@ -31,7 +31,7 @@ const useGetEntityByUrl = (externalUrl: string) => { const getLookupData = () => { if (!data) return {} as const; - const entities = data.searchAcrossEntities?.searchResults.map((result) => result.entity) ?? []; + const entities = data.searchAcrossEntities?.searchResults?.map((result) => result.entity) ?? []; const notFound = entities.length === 0; const foundMultiple = entities.length > 1; const entity = entities.length === 1 ? entities[0] : null; diff --git a/datahub-web-react/src/app/entity/businessAttribute/profile/BusinessAttributeRelatedEntity.tsx b/datahub-web-react/src/app/entity/businessAttribute/profile/BusinessAttributeRelatedEntity.tsx index 46d9d4ea51d245..a73b36d6922279 100644 --- a/datahub-web-react/src/app/entity/businessAttribute/profile/BusinessAttributeRelatedEntity.tsx +++ b/datahub-web-react/src/app/entity/businessAttribute/profile/BusinessAttributeRelatedEntity.tsx @@ -18,7 +18,7 @@ export default function BusinessAttributeRelatedEntity() { ]) || []; - entityData?.isAChildren?.relationships.forEach((businessAttribute) => { + entityData?.isAChildren?.relationships?.forEach((businessAttribute) => { const childUrn = businessAttribute.entity?.urn; if (childUrn) { diff --git a/datahub-web-react/src/app/entity/chart/ChartEntity.tsx b/datahub-web-react/src/app/entity/chart/ChartEntity.tsx index 70fe8a5e7c7c23..b20116f615556d 100644 --- a/datahub-web-react/src/app/entity/chart/ChartEntity.tsx +++ b/datahub-web-react/src/app/entity/chart/ChartEntity.tsx @@ -142,9 +142,9 @@ export class ChartEntity implements Entity { component: EmbedTab, display: { visible: (_, chart: GetChartQuery) => - !!chart?.chart?.embed?.renderUrl && chart?.chart?.platform.urn === LOOKER_URN, + !!chart?.chart?.embed?.renderUrl && chart?.chart?.platform?.urn === LOOKER_URN, enabled: (_, chart: GetChartQuery) => - !!chart?.chart?.embed?.renderUrl && chart?.chart?.platform.urn === LOOKER_URN, + !!chart?.chart?.embed?.renderUrl && chart?.chart?.platform?.urn === LOOKER_URN, }, }, { @@ -170,7 +170,7 @@ export class ChartEntity implements Entity { name: 'Incidents', component: IncidentTab, getDynamicName: (_, chart) => { - const activeIncidentCount = chart?.chart?.activeIncidents.total; + const activeIncidentCount = chart?.chart?.activeIncidents?.total; return `Incidents${(activeIncidentCount && ` (${activeIncidentCount})`) || ''}`; }, }, diff --git a/datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx b/datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx index 7d0275f60435a9..c35b1f90ee9c00 100644 --- a/datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx +++ b/datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx @@ -149,10 +149,10 @@ export class DashboardEntity implements Entity { display: { visible: (_, dashboard: GetDashboardQuery) => !!dashboard?.dashboard?.embed?.renderUrl && - dashboard?.dashboard?.platform.urn === LOOKER_URN, + dashboard?.dashboard?.platform?.urn === LOOKER_URN, enabled: (_, dashboard: GetDashboardQuery) => !!dashboard?.dashboard?.embed?.renderUrl && - dashboard?.dashboard?.platform.urn === LOOKER_URN, + dashboard?.dashboard?.platform?.urn === LOOKER_URN, }, }, { @@ -170,7 +170,7 @@ export class DashboardEntity implements Entity { name: 'Incidents', component: IncidentTab, getDynamicName: (_, dashboard) => { - const activeIncidentCount = dashboard?.dashboard?.activeIncidents.total; + const activeIncidentCount = dashboard?.dashboard?.activeIncidents?.total; return `Incidents${(activeIncidentCount && ` (${activeIncidentCount})`) || ''}`; }, }, diff --git a/datahub-web-react/src/app/entity/dataFlow/DataFlowEntity.tsx b/datahub-web-react/src/app/entity/dataFlow/DataFlowEntity.tsx index 42555a0dd3f37d..3c03dfb65ccbcd 100644 --- a/datahub-web-react/src/app/entity/dataFlow/DataFlowEntity.tsx +++ b/datahub-web-react/src/app/entity/dataFlow/DataFlowEntity.tsx @@ -92,7 +92,7 @@ export class DataFlowEntity implements Entity { name: 'Incidents', component: IncidentTab, getDynamicName: (_, dataFlow) => { - const activeIncidentCount = dataFlow?.dataFlow?.activeIncidents.total; + const activeIncidentCount = dataFlow?.dataFlow?.activeIncidents?.total; return `Incidents${(activeIncidentCount && ` (${activeIncidentCount})`) || ''}`; }, }, diff --git a/datahub-web-react/src/app/entity/dataJob/DataJobEntity.tsx b/datahub-web-react/src/app/entity/dataJob/DataJobEntity.tsx index 503acf7652dfa6..5b1aaeaef76d5b 100644 --- a/datahub-web-react/src/app/entity/dataJob/DataJobEntity.tsx +++ b/datahub-web-react/src/app/entity/dataJob/DataJobEntity.tsx @@ -112,7 +112,7 @@ export class DataJobEntity implements Entity { name: 'Incidents', component: IncidentTab, getDynamicName: (_, dataJob) => { - const activeIncidentCount = dataJob?.dataJob?.activeIncidents.total; + const activeIncidentCount = dataJob?.dataJob?.activeIncidents?.total; return `Incidents${(activeIncidentCount && ` (${activeIncidentCount})`) || ''}`; }, }, diff --git a/datahub-web-react/src/app/entity/dataJob/tabs/RunsTab.tsx b/datahub-web-react/src/app/entity/dataJob/tabs/RunsTab.tsx index 5cd621719ce8fd..f00e3402c8ed4c 100644 --- a/datahub-web-react/src/app/entity/dataJob/tabs/RunsTab.tsx +++ b/datahub-web-react/src/app/entity/dataJob/tabs/RunsTab.tsx @@ -129,8 +129,8 @@ export const RunsTab = () => { name: run?.name, status: run?.state?.[0]?.status, resultType: run?.state?.[0]?.result?.resultType, - inputs: run?.inputs?.relationships.map((relationship) => relationship.entity), - outputs: run?.outputs?.relationships.map((relationship) => relationship.entity), + inputs: run?.inputs?.relationships?.map((relationship) => relationship.entity), + outputs: run?.outputs?.relationships?.map((relationship) => relationship.entity), externalUrl: run?.externalUrl, })); if (loading) { diff --git a/datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx b/datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx index 35ed3ffcc4c532..abf8e732c47d61 100644 --- a/datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx +++ b/datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx @@ -217,7 +217,7 @@ export class DatasetEntity implements Entity { name: 'Incidents', component: IncidentTab, getDynamicName: (_, dataset) => { - const activeIncidentCount = dataset?.dataset?.activeIncidents.total; + const activeIncidentCount = dataset?.dataset?.activeIncidents?.total; return `Incidents${(activeIncidentCount && ` (${activeIncidentCount})`) || ''}`; }, }, diff --git a/datahub-web-react/src/app/entity/dataset/profile/OperationsTab.tsx b/datahub-web-react/src/app/entity/dataset/profile/OperationsTab.tsx index 78ec334f071ba4..d3371d3790d028 100644 --- a/datahub-web-react/src/app/entity/dataset/profile/OperationsTab.tsx +++ b/datahub-web-react/src/app/entity/dataset/profile/OperationsTab.tsx @@ -195,8 +195,8 @@ export const OperationsTab = () => { status: run?.state?.[0]?.status, resultType: run?.state?.[0]?.result?.resultType, duration: run?.state?.[0]?.durationMillis, - inputs: run?.inputs?.relationships.map((relationship) => relationship.entity), - outputs: run?.outputs?.relationships.map((relationship) => relationship.entity), + inputs: run?.inputs?.relationships?.map((relationship) => relationship.entity), + outputs: run?.outputs?.relationships?.map((relationship) => relationship.entity), externalUrl: run?.externalUrl, parentTemplate: run?.parentTemplate?.relationships?.[0]?.entity, })); diff --git a/datahub-web-react/src/app/entity/dataset/profile/schema/utils/schemaTitleRenderer.tsx b/datahub-web-react/src/app/entity/dataset/profile/schema/utils/schemaTitleRenderer.tsx index 3d03b6306454d8..fdd03622fc0e19 100644 --- a/datahub-web-react/src/app/entity/dataset/profile/schema/utils/schemaTitleRenderer.tsx +++ b/datahub-web-react/src/app/entity/dataset/profile/schema/utils/schemaTitleRenderer.tsx @@ -69,7 +69,7 @@ export default function useSchemaTitleRenderer( ?.filter( (constraint) => (constraint?.sourceFields?.filter( - (sourceField) => sourceField?.fieldPath.trim() === fieldPath.trim(), + (sourceField) => sourceField?.fieldPath?.trim() === fieldPath.trim(), ).length || 0) > 0, ) .map((constraint) => ( diff --git a/datahub-web-react/src/app/entity/dataset/profile/schema/utils/utils.ts b/datahub-web-react/src/app/entity/dataset/profile/schema/utils/utils.ts index 51cb8ab0245196..9d719ae25e2bed 100644 --- a/datahub-web-react/src/app/entity/dataset/profile/schema/utils/utils.ts +++ b/datahub-web-react/src/app/entity/dataset/profile/schema/utils/utils.ts @@ -37,7 +37,7 @@ export function convertEditableSchemaMetadataForUpdate( ): EditableSchemaMetadataUpdate { return { editableSchemaFieldInfo: - editableSchemaMetadata?.editableSchemaFieldInfo.map((editableSchemaFieldInfo) => ({ + editableSchemaMetadata?.editableSchemaFieldInfo?.map((editableSchemaFieldInfo) => ({ fieldPath: editableSchemaFieldInfo?.fieldPath, description: editableSchemaFieldInfo?.description, globalTags: { tags: convertTagsForUpdate(editableSchemaFieldInfo?.globalTags?.tags || []) }, diff --git a/datahub-web-react/src/app/entity/domain/DataProductsTab/DataProductsTab.tsx b/datahub-web-react/src/app/entity/domain/DataProductsTab/DataProductsTab.tsx index c834597e41a6d5..15cc99127f3500 100644 --- a/datahub-web-react/src/app/entity/domain/DataProductsTab/DataProductsTab.tsx +++ b/datahub-web-react/src/app/entity/domain/DataProductsTab/DataProductsTab.tsx @@ -70,7 +70,7 @@ export default function DataProductsTab() { }, }); const totalResults = data?.searchAcrossEntities?.total || 0; - const searchResults = data?.searchAcrossEntities?.searchResults.map((r) => r.entity) || []; + const searchResults = data?.searchAcrossEntities?.searchResults?.map((r) => r.entity) || []; const dataProducts = [...createdDataProducts, ...searchResults]; const displayedDataProducts = dataProducts .map( diff --git a/datahub-web-react/src/app/entity/glossaryTerm/profile/AddRelatedTermsModal.tsx b/datahub-web-react/src/app/entity/glossaryTerm/profile/AddRelatedTermsModal.tsx index a609dc4cca599d..9131af265a7516 100644 --- a/datahub-web-react/src/app/entity/glossaryTerm/profile/AddRelatedTermsModal.tsx +++ b/datahub-web-react/src/app/entity/glossaryTerm/profile/AddRelatedTermsModal.tsx @@ -104,7 +104,10 @@ function AddRelatedTermsModal(props: Props) { const newUrns = [...selectedUrns, urn]; setSelectedUrns(newUrns); const selectedSearchOption = tagSearchOptions.find((option) => option.props.value === urn); - setSelectedTerms([...selectedTerms, { urn, component: }]); + setSelectedTerms([ + ...selectedTerms, + { urn, component: }, + ]); }; // When a Tag or term search result is deselected, remove the urn from the Owners diff --git a/datahub-web-react/src/app/entity/glossaryTerm/profile/GlossaryRelatedEntity.tsx b/datahub-web-react/src/app/entity/glossaryTerm/profile/GlossaryRelatedEntity.tsx index 098e97e526fd84..6959fc082f7346 100644 --- a/datahub-web-react/src/app/entity/glossaryTerm/profile/GlossaryRelatedEntity.tsx +++ b/datahub-web-react/src/app/entity/glossaryTerm/profile/GlossaryRelatedEntity.tsx @@ -22,7 +22,7 @@ export default function GlossaryRelatedEntity() { ]) || []; - entityData?.isAChildren?.relationships.forEach((term) => { + entityData?.isAChildren?.relationships?.forEach((term) => { const childUrn = term.entity?.urn; if (childUrn) { diff --git a/datahub-web-react/src/app/entity/mlFeatureTable/profile/Sources.tsx b/datahub-web-react/src/app/entity/mlFeatureTable/profile/Sources.tsx index eb114e9774e294..56c0fcbb602003 100644 --- a/datahub-web-react/src/app/entity/mlFeatureTable/profile/Sources.tsx +++ b/datahub-web-react/src/app/entity/mlFeatureTable/profile/Sources.tsx @@ -35,14 +35,14 @@ export default function SourcesView() { features?.reduce((accumulator: Array, feature) => { if (feature.__typename === 'MLFeature' && feature.properties?.sources) { // eslint-disable-next-line array-callback-return - feature.properties?.sources.map((source: Dataset | null) => { + feature.properties?.sources?.map((source: Dataset | null) => { if (source && accumulator.findIndex((dataset) => dataset.urn === source?.urn) === -1) { accumulator.push(source); } }); } else if (feature.__typename === 'MLPrimaryKey' && feature.properties?.sources) { // eslint-disable-next-line array-callback-return - feature.properties?.sources.map((source: Dataset | null) => { + feature.properties?.sources?.map((source: Dataset | null) => { if (source && accumulator.findIndex((dataset) => dataset.urn === source?.urn) === -1) { accumulator.push(source); } diff --git a/datahub-web-react/src/app/entity/mlModel/profile/MlModelFeaturesTab.tsx b/datahub-web-react/src/app/entity/mlModel/profile/MlModelFeaturesTab.tsx index b8dc64793c2256..7fd719177d1516 100644 --- a/datahub-web-react/src/app/entity/mlModel/profile/MlModelFeaturesTab.tsx +++ b/datahub-web-react/src/app/entity/mlModel/profile/MlModelFeaturesTab.tsx @@ -9,7 +9,7 @@ export default function MlModelFeaturesTab() { const entity = useBaseEntity() as GetMlModelQuery; const model = entity && entity.mlModel; - const features = model?.features?.relationships.map((relationship) => relationship.entity) as Array< + const features = model?.features?.relationships?.map((relationship) => relationship.entity) as Array< MlFeature | MlPrimaryKey >; diff --git a/datahub-web-react/src/app/entity/ownership/OwnershipList.tsx b/datahub-web-react/src/app/entity/ownership/OwnershipList.tsx index 8d6e109d2bca36..3d7904a5c55052 100644 --- a/datahub-web-react/src/app/entity/ownership/OwnershipList.tsx +++ b/datahub-web-react/src/app/entity/ownership/OwnershipList.tsx @@ -64,7 +64,7 @@ export const OwnershipList = () => { }); const totalOwnershipTypes = data?.listOwnershipTypes?.total || 0; const ownershipTypes = - data?.listOwnershipTypes?.ownershipTypes.filter((type) => type.urn !== 'urn:li:ownershipType:none') || []; + data?.listOwnershipTypes?.ownershipTypes?.filter((type) => type.urn !== 'urn:li:ownershipType:none') || []; const onClickCreateOwnershipType = () => { setShowOwnershipBuilder(true); diff --git a/datahub-web-react/src/app/entity/shared/EntityDropdown/DomainParentSelect.tsx b/datahub-web-react/src/app/entity/shared/EntityDropdown/DomainParentSelect.tsx index d43b04ec11a165..1e918757e46192 100644 --- a/datahub-web-react/src/app/entity/shared/EntityDropdown/DomainParentSelect.tsx +++ b/datahub-web-react/src/app/entity/shared/EntityDropdown/DomainParentSelect.tsx @@ -23,7 +23,7 @@ export function filterResultsForMove(entity: Domain, entityUrn: string) { return ( entity.urn !== entityUrn && entity.__typename === 'Domain' && - !entity.parentDomains?.domains.some((node) => node.urn === entityUrn) + !entity.parentDomains?.domains?.some((node) => node.urn === entityUrn) ); } diff --git a/datahub-web-react/src/app/entity/shared/EntityDropdown/NodeParentSelect.tsx b/datahub-web-react/src/app/entity/shared/EntityDropdown/NodeParentSelect.tsx index 7227354a465695..3746c5f6b95f82 100644 --- a/datahub-web-react/src/app/entity/shared/EntityDropdown/NodeParentSelect.tsx +++ b/datahub-web-react/src/app/entity/shared/EntityDropdown/NodeParentSelect.tsx @@ -22,7 +22,7 @@ export function filterResultsForMove(entity: GlossaryNode, entityUrn: string) { return ( entity.urn !== entityUrn && entity.__typename === 'GlossaryNode' && - !entity.parentNodes?.nodes.some((node) => node.urn === entityUrn) + !entity.parentNodes?.nodes?.some((node) => node.urn === entityUrn) ); } diff --git a/datahub-web-react/src/app/entity/shared/EntityDropdown/useHandleMoveDomainComplete.ts b/datahub-web-react/src/app/entity/shared/EntityDropdown/useHandleMoveDomainComplete.ts index 81f19331e18b77..2d9c346e18d5b4 100644 --- a/datahub-web-react/src/app/entity/shared/EntityDropdown/useHandleMoveDomainComplete.ts +++ b/datahub-web-react/src/app/entity/shared/EntityDropdown/useHandleMoveDomainComplete.ts @@ -13,7 +13,7 @@ export function useHandleMoveDomainComplete() { if (!entityData) return; const domain = entityData as Domain; - const oldParentUrn = domain.parentDomains?.domains.length ? domain.parentDomains.domains[0].urn : undefined; + const oldParentUrn = domain.parentDomains?.domains?.length ? domain.parentDomains.domains[0].urn : undefined; analytics.event({ type: EventType.MoveDomainEvent, diff --git a/datahub-web-react/src/app/entity/shared/__tests__/siblingsUtils.test.ts b/datahub-web-react/src/app/entity/shared/__tests__/siblingsUtils.test.ts index 00e89e5943c176..f3b857ab2ef3be 100644 --- a/datahub-web-react/src/app/entity/shared/__tests__/siblingsUtils.test.ts +++ b/datahub-web-react/src/app/entity/shared/__tests__/siblingsUtils.test.ts @@ -203,10 +203,10 @@ describe('siblingUtils', () => { // merges schema metadata properly by fieldPath expect(combinedData.dataset.schemaMetadata?.fields).toHaveLength(4); - expect(combinedData.dataset.schemaMetadata?.fields[0].fieldPath).toEqual('new_one'); - expect(combinedData.dataset.schemaMetadata?.fields[1].fieldPath).toEqual('DUPLICATE_FIELD'); - expect(combinedData.dataset.schemaMetadata?.fields[2].fieldPath).toEqual('user_id'); - expect(combinedData.dataset.schemaMetadata?.fields[3].fieldPath).toEqual('user_name'); + expect(combinedData.dataset.schemaMetadata?.fields[0]?.fieldPath).toEqual('new_one'); + expect(combinedData.dataset.schemaMetadata?.fields[1]?.fieldPath).toEqual('DUPLICATE_FIELD'); + expect(combinedData.dataset.schemaMetadata?.fields[2]?.fieldPath).toEqual('user_id'); + expect(combinedData.dataset.schemaMetadata?.fields[3]?.fieldPath).toEqual('user_name'); // will overwrite string properties w/ primary expect(combinedData.dataset.editableProperties.description).toEqual('secondary description'); diff --git a/datahub-web-react/src/app/entity/shared/components/styled/ERModelRelationship/CreateERModelRelationModal.tsx b/datahub-web-react/src/app/entity/shared/components/styled/ERModelRelationship/CreateERModelRelationModal.tsx index ea40fb71818033..de22daeeedd817 100644 --- a/datahub-web-react/src/app/entity/shared/components/styled/ERModelRelationship/CreateERModelRelationModal.tsx +++ b/datahub-web-react/src/app/entity/shared/components/styled/ERModelRelationship/CreateERModelRelationModal.tsx @@ -241,9 +241,9 @@ export const CreateERModelRelationModal = ({ }; const table1NameBusiness = getDatasetName(table1Dataset); - const table1NameTech = table1Dataset?.name || table1Dataset?.urn.split(',').at(1) || ''; + const table1NameTech = table1Dataset?.name || table1Dataset?.urn?.split(',').at(1) || ''; const table2NameBusiness = getDatasetName(table2Dataset); - const table2NameTech = table2Dataset?.name || table2Dataset?.urn.split(',').at(1) || ''; + const table2NameTech = table2Dataset?.name || table2Dataset?.urn?.split(',').at(1) || ''; const handleAdd = () => { const newData: ERModelRelationDataType = { diff --git a/datahub-web-react/src/app/entity/shared/components/styled/ERModelRelationship/ERModelRelationUtils.tsx b/datahub-web-react/src/app/entity/shared/components/styled/ERModelRelationship/ERModelRelationUtils.tsx index e7a242daa5121a..0eb198aec48033 100644 --- a/datahub-web-react/src/app/entity/shared/components/styled/ERModelRelationship/ERModelRelationUtils.tsx +++ b/datahub-web-react/src/app/entity/shared/components/styled/ERModelRelationship/ERModelRelationUtils.tsx @@ -68,6 +68,6 @@ export function getDatasetName(datainput: any): string { datainput?.editableProperties?.name || datainput?.properties?.name || datainput?.name || - datainput?.urn.split(',').at(1) + datainput?.urn?.split(',').at(1) ); } diff --git a/datahub-web-react/src/app/entity/shared/components/styled/ERModelRelationship/EditableCell.tsx b/datahub-web-react/src/app/entity/shared/components/styled/ERModelRelationship/EditableCell.tsx index a190d9090cc8c4..4320aacd53e4af 100644 --- a/datahub-web-react/src/app/entity/shared/components/styled/ERModelRelationship/EditableCell.tsx +++ b/datahub-web-react/src/app/entity/shared/components/styled/ERModelRelationship/EditableCell.tsx @@ -53,7 +53,7 @@ export const EditableCell = ({