Compare commits

...

3 Commits

Author SHA1 Message Date
Ashwin Bhatkal
f56d78cfc5 fix: guard queryFormulas against non-array values in useGetQueryLabels 2026-03-24 20:01:40 +05:30
Ashwin Bhatkal
b92f15b7c6 fix: optional chain orderBy access in useLogsData to prevent crash 2026-03-24 20:00:20 +05:30
Ashwin Bhatkal
9d778ed79a fix: guard label.toLowerCase() against non-string values in NewSelect 2026-03-24 19:59:27 +05:30
3 changed files with 10 additions and 9 deletions

View File

@@ -127,7 +127,7 @@ export const filterOptionsBySearch = (
if ('options' in option && Array.isArray(option.options)) {
// Filter nested options
const filteredSubOptions = option.options.filter((subOption) =>
subOption.label.toLowerCase().includes(lowerSearchText),
String(subOption.label).toLowerCase().includes(lowerSearchText),
);
return filteredSubOptions.length > 0
@@ -136,7 +136,7 @@ export const filterOptionsBySearch = (
}
// Filter top-level options
return option.label.toLowerCase().includes(lowerSearchText)
return String(option.label).toLowerCase().includes(lowerSearchText)
? option
: undefined;
})

View File

@@ -11,12 +11,13 @@ export const useGetQueryLabels = (
const queryLabels = getQueryLabelWithAggregation(
currentQuery?.builder?.queryData || [],
);
const formulaLabels = (currentQuery?.builder?.queryFormulas ?? []).map(
(formula) => ({
label: formula.queryName,
value: formula.queryName,
}),
);
const formulaLabels = (Array.isArray(currentQuery?.builder?.queryFormulas)
? currentQuery.builder.queryFormulas
: []
).map((formula) => ({
label: formula.queryName,
value: formula.queryName,
}));
return [...queryLabels, ...formulaLabels];
}
if (currentQuery?.queryType === EQueryType.CLICKHOUSE) {

View File

@@ -71,7 +71,7 @@ export const useLogsData = ({
}, [logs.length, listQuery]);
const orderByTimestamp: OrderByPayload | null = useMemo(() => {
const timestampOrderBy = listQuery?.orderBy.find(
const timestampOrderBy = listQuery?.orderBy?.find(
(item) => item.columnName === 'timestamp',
);