From 0b8f722e13c717888733cdf19fca50b3029921e5 Mon Sep 17 00:00:00 2001 From: SagarRajput-7 Date: Wed, 4 Sep 2024 15:28:30 +0530 Subject: [PATCH] fix: added default fallback for selectedColumns, when the attributeKeys call gives empty --- frontend/src/container/OptionsMenu/useOptionsMenu.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/src/container/OptionsMenu/useOptionsMenu.ts b/frontend/src/container/OptionsMenu/useOptionsMenu.ts index 7b3cfce035..a4a91d82f4 100644 --- a/frontend/src/container/OptionsMenu/useOptionsMenu.ts +++ b/frontend/src/container/OptionsMenu/useOptionsMenu.ts @@ -140,6 +140,11 @@ const useOptionsMenu = ({ return col; }) .filter(Boolean) as BaseAutocompleteData[]; + + // this is the last point where we can set the default columns and if uptil now also we have an empty array then we will set the default columns + if (!initialSelected || !initialSelected?.length) { + initialSelected = defaultTraceSelectedColumns; + } } return initialSelected || [];