From cc9133a25501389532e00215246c9df088194d90 Mon Sep 17 00:00:00 2001 From: Martin Marosi Date: Thu, 7 Dec 2023 15:02:02 +0100 Subject: [PATCH] Remove appId from chrome state. --- src/components/ChromeLink/ChromeLink.tsx | 4 +++- src/components/GlobalFilter/GlobalFilter.tsx | 3 ++- src/redux/store.d.ts | 5 ----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/ChromeLink/ChromeLink.tsx b/src/components/ChromeLink/ChromeLink.tsx index 0c8aa3127..a6272d73c 100644 --- a/src/components/ChromeLink/ChromeLink.tsx +++ b/src/components/ChromeLink/ChromeLink.tsx @@ -7,6 +7,8 @@ import { appNavClick } from '../../redux/actions'; import NavContext, { OnLinkClick } from '../Navigation/navContext'; import { ReduxState } from '../../redux/store'; import { NavDOMEvent, RouteDefinition } from '../../@types/types'; +import { useAtomValue } from 'jotai'; +import { activeModuleAtom } from '../../state/atoms'; interface RefreshLinkProps extends React.HTMLAttributes { isExternal?: boolean; @@ -137,7 +139,7 @@ const RefreshLink: React.FC = (props) => { const ChromeLink: React.FC = ({ appId, children, ...rest }) => { const { onLinkClick, isNavOpen, inPageLayout } = useContext(NavContext); - const currAppId = useSelector(({ chrome }: ReduxState) => chrome?.appId); + const currAppId = useAtomValue(activeModuleAtom); const LinkComponent = !rest.isExternal ? LinkWrapper : RefreshLink; return ( diff --git a/src/components/GlobalFilter/GlobalFilter.tsx b/src/components/GlobalFilter/GlobalFilter.tsx index b9abf199a..b03f4f2d9 100644 --- a/src/components/GlobalFilter/GlobalFilter.tsx +++ b/src/components/GlobalFilter/GlobalFilter.tsx @@ -18,7 +18,8 @@ import { activeModuleAtom } from '../../state/atoms'; const useLoadTags = (hasAccess = false) => { const navigate = useNavigate(); const registeredWith = useSelector(({ globalFilter: { scope } }: ReduxState) => scope); - const isDisabled = useSelector(({ globalFilter: { globalFilterHidden }, chrome: { appId } }: ReduxState) => globalFilterHidden || !appId); + const activeModule = useAtomValue(activeModuleAtom); + const isDisabled = useSelector(({ globalFilter: { globalFilterHidden } }: ReduxState) => globalFilterHidden || !activeModule); const dispatch = useDispatch(); return useCallback( debounce((activeTags: any, search: any) => { diff --git a/src/redux/store.d.ts b/src/redux/store.d.ts index 231468388..3ae8c581b 100644 --- a/src/redux/store.d.ts +++ b/src/redux/store.d.ts @@ -40,11 +40,6 @@ export type ChromeState = { contextSwitcherOpen: boolean; activeApp?: string; activeProduct?: string; - /** - * @deprecated - * App id is replaced by active module. It is still required until we completely remove usage of main.yml - */ - appId?: string; missingIDP?: boolean; pageAction?: string; pageObjectId?: string;