Skip to content

Commit

Permalink
fix: simplify useFramework hook by removing EventModule dependency in…
Browse files Browse the repository at this point in the history
… useNavigateOnContextChange
  • Loading branch information
Noggling committed Nov 19, 2024
1 parent b42a403 commit 2aaeca8
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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) => {
Expand All @@ -27,5 +26,5 @@ export const useNavigateOnContextChange = () => {

modules.navigation.push(url);
});
}, [modules]);
}, []);
};

0 comments on commit 2aaeca8

Please sign in to comment.