Skip to content

Commit dd23f9e

Browse files
authored
fix(ui): null dereference (#12193)
1 parent d06980f commit dd23f9e

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

datahub-web-react/src/app/entity/shared/components/styled/ERModelRelationship/ERModelRelationUtils.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ export function getDatasetName(datainput: any): string {
6868
datainput?.editableProperties?.name ||
6969
datainput?.properties?.name ||
7070
datainput?.name ||
71-
datainput?.urn?.split(',').at(1)
71+
datainput?.urn?.split(',')?.at(1)
7272
);
7373
}

datahub-web-react/src/app/entity/shared/tabs/Dataset/Queries/utils/filterQueries.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export const filterQueries = (filterText, queries: Query[]) => {
1010
const lowerFilterText = filterText.toLowerCase();
1111
return queries.filter((query) => {
1212
return (
13-
query.title?.toLowerCase().includes(lowerFilterText) ||
14-
query.description?.toLowerCase().includes(lowerFilterText) ||
15-
query.query?.toLowerCase().includes(lowerFilterText)
13+
query.title?.toLowerCase()?.includes(lowerFilterText) ||
14+
query.description?.toLowerCase()?.includes(lowerFilterText) ||
15+
query.query?.toLowerCase()?.includes(lowerFilterText)
1616
);
1717
});
1818
};

datahub-web-react/src/app/entity/shared/tabs/Dataset/Schema/utils/filterSchemaRows.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function matchesTagsOrTermsOrDescription(field: SchemaField, filterText: string,
1212
.toLocaleLowerCase()
1313
.includes(filterText),
1414
) ||
15-
field.description?.toLocaleLowerCase().includes(filterText)
15+
field.description?.toLocaleLowerCase()?.includes(filterText)
1616
);
1717
}
1818

datahub-web-react/src/app/ingest/source/executions/ExecutionRequestDetailsModal.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export const ExecutionDetailsModal = ({ urn, open, onClose }: Props) => {
129129
downloadFile(output, `exec-${urn}.log`);
130130
};
131131

132-
const logs = (showExpandedLogs && output) || output?.split('\n').slice(0, 5).join('\n');
132+
const logs = (showExpandedLogs && output) || output?.split('\n')?.slice(0, 5)?.join('\n');
133133
const result = data?.executionRequest?.result as Partial<ExecutionRequestResult>;
134134
const status = getIngestionSourceStatus(result);
135135

@@ -163,7 +163,7 @@ export const ExecutionDetailsModal = ({ urn, open, onClose }: Props) => {
163163
} catch (e) {
164164
recipeYaml = '';
165165
}
166-
const recipe = showExpandedRecipe ? recipeYaml : recipeYaml?.split('\n').slice(0, 5).join('\n');
166+
const recipe = showExpandedRecipe ? recipeYaml : recipeYaml?.split('\n')?.slice(0, 5)?.join('\n');
167167

168168
const areLogsExpandable = output?.split(/\r\n|\r|\n/)?.length > 5;
169169
const isRecipeExpandable = recipeYaml?.split(/\r\n|\r|\n/)?.length > 5;

datahub-web-react/src/app/lineage/utils/titleUtils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ function truncate(input, length) {
124124
function getLastTokenOfTitle(title?: string): string {
125125
if (!title) return '';
126126

127-
const lastToken = title?.split('.').slice(-1)[0];
127+
const lastToken = title?.split('.')?.slice(-1)?.[0];
128128

129129
// if the last token does not contain any content, the string should not be tokenized on `.`
130-
if (lastToken.replace(/\s/g, '').length === 0) {
130+
if (lastToken?.replace(/\s/g, '')?.length === 0) {
131131
return title;
132132
}
133133

datahub-web-react/src/app/search/context/SearchResultContext.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const useSearchResult = () => {
4040
};
4141

4242
export const useEntityType = () => {
43-
return useSearchResultContext()?.searchResult.entity.type;
43+
return useSearchResultContext()?.searchResult?.entity?.type;
4444
};
4545

4646
export const useMatchedFields = () => {

datahub-web-react/src/app/search/matches/MatchedFieldList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const RenderedField = ({
4242
field: MatchedField;
4343
}) => {
4444
const entityRegistry = useEntityRegistry();
45-
const query = useSearchQuery()?.trim().toLowerCase();
45+
const query = useSearchQuery()?.trim()?.toLowerCase();
4646
const customRenderedField = customFieldRenderer?.(field);
4747
if (customRenderedField) return <b>{customRenderedField}</b>;
4848
if (isHighlightableEntityField(field)) {

datahub-web-react/src/app/search/matches/SearchTextHighlighter.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const SearchTextHighlighter = ({ field, text, enableFullHighlight = false }: Pro
2323
const enableNameHighlight = appConfig.config.visualConfig.searchResult?.enableNameHighlight;
2424
const matchedFields = useMatchedFieldsByGroup(field);
2525
const hasMatchedField = !!matchedFields?.length;
26-
const normalizedSearchQuery = useSearchQuery()?.trim().toLowerCase();
26+
const normalizedSearchQuery = useSearchQuery()?.trim()?.toLowerCase();
2727
const normalizedText = text.trim().toLowerCase();
2828
const hasSubstring = hasMatchedField && !!normalizedSearchQuery && normalizedText.includes(normalizedSearchQuery);
2929
const pattern = enableFullHighlight ? HIGHLIGHT_ALL_PATTERN : undefined;

0 commit comments

Comments
 (0)