Skip to content

Commit

Permalink
fix: added safety check for query filter items (#6004)
Browse files Browse the repository at this point in the history
* fix: added safety check for query filter items

* fix: added a bunch of missing safety nets
  • Loading branch information
vikrantgupta25 authored Sep 18, 2024
1 parent cbcef2c commit 1024483
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function FullView({

const [graphsVisibilityStates, setGraphsVisibilityStates] = useState<
boolean[]
>(Array(response.data?.payload.data.result.length).fill(true));
>(Array(response.data?.payload?.data?.result?.length).fill(true));

useEffect(() => {
const {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/hooks/queryBuilder/useFetchKeysAndValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const useFetchKeysAndValues = (
const queryFiltersWithoutId = useMemo(
() => ({
...query.filters,
items: query.filters.items.map((item) => {
items: query.filters?.items?.map((item) => {
const filterWithoutId = cloneDeep(item);
unset(filterWithoutId, 'id');
return filterWithoutId;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/LogsExplorer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function LogsExplorer(): JSX.Element {
}
if (
currentQuery.builder.queryData.length === 1 &&
currentQuery.builder.queryData[0].groupBy.length > 0
currentQuery.builder.queryData?.[0]?.groupBy?.length > 0
) {
handleChangeSelectedView(SELECTED_VIEWS.QUERY_BUILDER);
}
Expand Down

0 comments on commit 1024483

Please sign in to comment.