From 2aaeca8051ad2a40d0ef27419ecfa74fd3bbd658 Mon Sep 17 00:00:00 2001 From: Christopher Berge Hove Date: Tue, 19 Nov 2024 20:02:50 +0100 Subject: [PATCH] fix: simplify useFramework hook by removing EventModule dependency in useNavigateOnContextChange --- .../src/hooks/use-navigate-on-context-change.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/portal/project-portal-common/src/hooks/use-navigate-on-context-change.ts b/portal/project-portal-common/src/hooks/use-navigate-on-context-change.ts index cef7a259..50b8ec9b 100644 --- a/portal/project-portal-common/src/hooks/use-navigate-on-context-change.ts +++ b/portal/project-portal-common/src/hooks/use-navigate-on-context-change.ts @@ -1,7 +1,6 @@ import { useEffect } from 'react'; import { NavigationModule } from '@equinor/fusion-framework-module-navigation'; -import { useFramework } from '@equinor/fusion-framework-react-app/framework'; -import { EventModule } from '@equinor/fusion-framework-module-event'; +import { useFramework } from '@equinor/fusion-framework-react'; import { getContextPageURL } from '../utils'; @@ -15,7 +14,7 @@ import { getContextPageURL } from '../utils'; * @returns {void} */ export const useNavigateOnContextChange = () => { - const { modules } = useFramework<[NavigationModule, EventModule]>(); + const { modules } = useFramework<[NavigationModule]>(); useEffect(() => { return modules.event.addEventListener('onCurrentContextChanged', (event) => { @@ -27,5 +26,5 @@ export const useNavigateOnContextChange = () => { modules.navigation.push(url); }); - }, [modules]); + }, []); };