diff --git a/src/gitops/components/shared/AllNamespaces/useShowOperandsInAllNamespaces.ts b/src/gitops/components/shared/AllNamespaces/useShowOperandsInAllNamespaces.ts index ff535b349..8c14bd1a1 100644 --- a/src/gitops/components/shared/AllNamespaces/useShowOperandsInAllNamespaces.ts +++ b/src/gitops/components/shared/AllNamespaces/useShowOperandsInAllNamespaces.ts @@ -6,9 +6,12 @@ type UseShowOperandsInAllNamespaces = () => [boolean, (value: boolean) => void]; // This hook can be used to consume and update the showOperandsInAllNamespaces redux state export const useShowOperandsInAllNamespaces: UseShowOperandsInAllNamespaces = () => { const dispatch = useDispatch(); - const showOperandsInAllNamespaces = useSelector((state: RootStateOrAny) => - state.UI.get('showOperandsInAllNamespaces'), - ); + const showOperandsInAllNamespaces = useSelector((state: RootStateOrAny) => { + const ui = state.UI; + return typeof ui?.get === 'function' + ? ui.get('showOperandsInAllNamespaces') + : ui?.showOperandsInAllNamespaces; + }); const setShowOperandsInAllNamespaces = useCallback( (value: boolean) => dispatch(uiActionsSetShowOperandsInAllNamespaces(value)), [dispatch], diff --git a/src/plugin/utils/useClusterVersion.tsx b/src/plugin/utils/useClusterVersion.tsx index a5a95c68b..5773f68a4 100644 --- a/src/plugin/utils/useClusterVersion.tsx +++ b/src/plugin/utils/useClusterVersion.tsx @@ -32,7 +32,7 @@ export type FlagsObject = { [key: string]: boolean }; export const getFlagsObject = ({ [featureReducerName]: featureState, -}: RootStateOrAny): FlagsObject => featureState.toObject(); +}: RootStateOrAny): FlagsObject => featureState?.toObject?.() ?? featureState; const getClusterVersionFlag = (state: RootStateOrAny) => getFlagsObject(state)?.['CLUSTER_VERSION'];