Skip to content

Commit

Permalink
fix(ui): null dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
anshbansal committed Dec 20, 2024
1 parent 01a2c0c commit 03ab2a3
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export const filterQueries = (filterText, queries: Query[]) => {
const lowerFilterText = filterText.toLowerCase();
return queries.filter((query) => {
return (
query.title?.toLowerCase().includes(lowerFilterText) ||
query.description?.toLowerCase().includes(lowerFilterText) ||
query.query?.toLowerCase().includes(lowerFilterText)
query.title?.toLowerCase()?.includes(lowerFilterText) ||
query.description?.toLowerCase()?.includes(lowerFilterText) ||
query.query?.toLowerCase()?.includes(lowerFilterText)
);
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function matchesTagsOrTermsOrDescription(field: SchemaField, filterText: string,
.toLocaleLowerCase()
.includes(filterText),
) ||
field.description?.toLocaleLowerCase().includes(filterText)
field.description?.toLocaleLowerCase()?.includes(filterText)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const ExecutionDetailsModal = ({ urn, open, onClose }: Props) => {
downloadFile(output, `exec-${urn}.log`);
};

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

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

const areLogsExpandable = output?.split(/\r\n|\r|\n/)?.length > 5;
const isRecipeExpandable = recipeYaml?.split(/\r\n|\r|\n/)?.length > 5;
Expand Down
2 changes: 1 addition & 1 deletion datahub-web-react/src/app/lineage/utils/titleUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function truncate(input, length) {
function getLastTokenOfTitle(title?: string): string {
if (!title) return '';

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

// if the last token does not contain any content, the string should not be tokenized on `.`
if (lastToken.replace(/\s/g, '').length === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const useSearchResult = () => {
};

export const useEntityType = () => {
return useSearchResultContext()?.searchResult.entity.type;
return useSearchResultContext()?.searchResult?.entity?.type;
};

export const useMatchedFields = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const RenderedField = ({
field: MatchedField;
}) => {
const entityRegistry = useEntityRegistry();
const query = useSearchQuery()?.trim().toLowerCase();
const query = useSearchQuery()?.trim()?.toLowerCase();
const customRenderedField = customFieldRenderer?.(field);
if (customRenderedField) return <b>{customRenderedField}</b>;
if (isHighlightableEntityField(field)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const SearchTextHighlighter = ({ field, text, enableFullHighlight = false }: Pro
const enableNameHighlight = appConfig.config.visualConfig.searchResult?.enableNameHighlight;
const matchedFields = useMatchedFieldsByGroup(field);
const hasMatchedField = !!matchedFields?.length;
const normalizedSearchQuery = useSearchQuery()?.trim().toLowerCase();
const normalizedSearchQuery = useSearchQuery()?.trim()?.toLowerCase();
const normalizedText = text.trim().toLowerCase();
const hasSubstring = hasMatchedField && !!normalizedSearchQuery && normalizedText.includes(normalizedSearchQuery);
const pattern = enableFullHighlight ? HIGHLIGHT_ALL_PATTERN : undefined;
Expand Down

0 comments on commit 03ab2a3

Please sign in to comment.