Skip to content

Commit

Permalink
Merge pull request #2911 from Hyperkid123/jotai-migration
Browse files Browse the repository at this point in the history
Remove obsolete document title redux state.
  • Loading branch information
Hyperkid123 authored Jul 29, 2024
2 parents 555a790 + af0b985 commit 5176bc2
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 26 deletions.
11 changes: 2 additions & 9 deletions src/bootstrap.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React, { Suspense, useContext, useEffect, useMemo, useState } from 'react';
import React, { Suspense, useContext, useEffect, useState } from 'react';
import { createRoot } from 'react-dom/client';
import { Provider, useSelector } from 'react-redux';
import { Provider } from 'react-redux';
import { IntlProvider, ReactIntlErrorCode } from 'react-intl';
import { Provider as JotaiProvider, useSetAtom } from 'jotai';

import { spinUpStore } from './redux/redux-config';
import RootApp from './components/RootApp';
import registerAnalyticsObserver from './analytics/analyticsObserver';
import { ITLess, getEnv, trustarcScriptSetup } from './utils/common';
import { ReduxState } from './redux/store';
import OIDCProvider from './auth/OIDCConnector/OIDCProvider';
import messages from './locales/data.json';
import ErrorBoundary from './components/ErrorComponents/ErrorBoundary';
Expand Down Expand Up @@ -47,16 +46,10 @@ const App = ({ initApp }: { initApp: (...args: Parameters<typeof initChromeUserC
getUser,
token,
});
const documentTitle = useSelector(({ chrome }: ReduxState) => chrome?.documentTitle);
const [cookieElement, setCookieElement] = useState<HTMLAnchorElement | null>(null);

useInitializeAnalytics();

useMemo(() => {
const title = typeof documentTitle === 'string' ? `${documentTitle} | Hybrid Cloud Console` : 'Hybrid Cloud Console';
document.title = title;
}, [documentTitle]);

return <RootApp cookieElement={cookieElement} setCookieElement={setCookieElement} />;
};

Expand Down
1 change: 0 additions & 1 deletion src/redux/action-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export const GLOBAL_FILTER_UPDATE = '@@chrome/global-filter-update';
export const GLOBAL_FILTER_TOGGLE = '@@chrome/global-filter-toggle';
export const GLOBAL_FILTER_REMOVE = '@@chrome/global-filter-remove';

export const UPDATE_DOCUMENT_TITLE_REDUCER = '@@chrome/update-document-title';
export const MARK_ACTIVE_PRODUCT = '@@chrome/mark-active-product';

export const STORE_INITIAL_HASH = '@@chrome/store-initial-hash';
5 changes: 0 additions & 5 deletions src/redux/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ export const onToggle = () => ({
type: 'NAVIGATION_TOGGLE',
});

export const updateDocumentTitle = (title: string) => ({
type: actionTypes.UPDATE_DOCUMENT_TITLE_REDUCER,
payload: title,
});

export const markActiveProduct = (product?: string) => ({
type: actionTypes.MARK_ACTIVE_PRODUCT,
payload: product,
Expand Down
7 changes: 0 additions & 7 deletions src/redux/chromeReducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ export function onPageObjectId(state: ChromeState, { payload }: { payload: strin
};
}

export function documentTitleReducer(state: ChromeState, { payload }: { payload: string }): ChromeState {
return {
...state,
documentTitle: payload,
};
}

export function markActiveProduct(state: ChromeState, { payload }: { payload?: string }): ChromeState {
return {
...state,
Expand Down
4 changes: 1 addition & 3 deletions src/redux/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { applyReducerHash } from '@redhat-cloud-services/frontend-components-utilities/ReducerRegistry';

import { documentTitleReducer, loginReducer, markActiveProduct, onPageAction, onPageObjectId } from './chromeReducers';
import { loginReducer, markActiveProduct, onPageAction, onPageObjectId } from './chromeReducers';
import {
globalFilterDefaultState,
onGetAllSIDs,
Expand All @@ -25,7 +25,6 @@ import {
GLOBAL_FILTER_TOGGLE,
GLOBAL_FILTER_UPDATE,
MARK_ACTIVE_PRODUCT,
UPDATE_DOCUMENT_TITLE_REDUCER,
USER_LOGIN,
} from './action-types';
import { ChromeState, GlobalFilterState, ReduxState } from './store';
Expand All @@ -35,7 +34,6 @@ const reducers = {
[USER_LOGIN]: loginReducer,
[CHROME_PAGE_ACTION]: onPageAction,
[CHROME_PAGE_OBJECT]: onPageObjectId,
[UPDATE_DOCUMENT_TITLE_REDUCER]: documentTitleReducer,
[MARK_ACTIVE_PRODUCT]: markActiveProduct,
};

Expand Down
1 change: 0 additions & 1 deletion src/redux/store.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export type ChromeState = {
pageAction?: string;
pageObjectId?: string;
initialHash?: string;
documentTitle?: string;
};

export type GlobalFilterWorkloads = {
Expand Down

0 comments on commit 5176bc2

Please sign in to comment.