Skip to content

Commit d30fcf2

Browse files
feat: use useGlobalAnnouncement
1 parent 5c3de38 commit d30fcf2

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/components/App/app.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
import { FunctionComponent, PropsWithChildren, useCallback, useEffect } from 'react';
99
import { useDispatch, useSelector } from 'react-redux';
1010
import { Grid } from '@mui/material';
11-
import { CardErrorBoundary, useNotificationsListener, useSnackMessage } from '@gridsuite/commons-ui';
11+
import {
12+
CardErrorBoundary,
13+
NotificationsUrlKeys,
14+
useNotificationsListener,
15+
useSnackMessage,
16+
} from '@gridsuite/commons-ui';
1217
import { selectComputedLanguage, selectLanguage, selectTheme } from '../../redux/actions';
1318
import { AppState } from '../../redux/reducer';
1419
import { ConfigParameters, ConfigSrv } from '../../services';
@@ -17,7 +22,6 @@ import { getComputedLanguage } from '../../utils/language';
1722
import AppTopBar from './app-top-bar';
1823
import { useDebugRender } from '../../utils/hooks';
1924
import { AppDispatch } from '../../redux/store';
20-
import { NOTIFICATIONS_URL_KEYS } from '../../utils/notifications-provider';
2125

2226
const App: FunctionComponent<PropsWithChildren<{}>> = (props, context) => {
2327
useDebugRender('app');
@@ -59,7 +63,7 @@ const App: FunctionComponent<PropsWithChildren<{}>> = (props, context) => {
5963
[updateParams, snackError]
6064
);
6165

62-
useNotificationsListener(NOTIFICATIONS_URL_KEYS.CONFIG, { listenerCallbackMessage: updateConfig });
66+
useNotificationsListener(NotificationsUrlKeys.CONFIG, { listenerCallbackMessage: updateConfig });
6367

6468
useEffect(() => {
6569
if (user !== null) {

src/utils/notifications-provider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function useNotificationsUrlGenerator() {
3232
[NotificationsUrlKeys.GLOBAL_CONFIG]: tokenId
3333
? getUrlWithToken(`${wsBase}${PREFIX_CONFIG_NOTIFICATION_WS}/global`)
3434
: undefined,
35-
}) satisfies { [Key in NotificationsUrlKeys]?: string | undefined },
35+
}) satisfies Partial<Record<NotificationsUrlKeys, string | undefined>>,
3636
[wsBase, tokenId]
3737
);
3838
}

0 commit comments

Comments
 (0)