Skip to content

Commit

Permalink
Upversion dependencies & fix redux state warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewballantyne committed Oct 31, 2023
1 parent debc4e8 commit c4c36d3
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 626 deletions.
653 changes: 40 additions & 613 deletions frontend/package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
},
"dependencies": {
"@openshift/dynamic-plugin-sdk": "^4.0.0",
"@openshift/dynamic-plugin-sdk-utils": "^4.0.0",
"@openshift/dynamic-plugin-sdk-utils": "^4.0.1",
"@patternfly/patternfly": "^5.1.0",
"@patternfly/quickstarts": "^5.0.0",
"@patternfly/quickstarts": "^5.1.0",
"@patternfly/react-catalog-view-extension": "^5.0.0",
"@patternfly/react-charts": "^7.1.1",
"@patternfly/react-code-editor": "^5.1.1",
Expand Down Expand Up @@ -72,7 +72,7 @@
"redux": "^4.2.0",
"redux-thunk": "^2.4.1",
"sass": "^1.56.2",
"showdown": "^1.9.1",
"showdown": "^2.1.0",
"yaml": "^2.2.2"
},
"devDependencies": {
Expand All @@ -85,7 +85,7 @@
"@types/react-dom": "^18.0.8",
"@types/react-redux": "^7.1.24",
"@types/react-router-dom": "^5.3.3",
"@types/showdown": "^1.9.3",
"@types/showdown": "^2.0.3",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
"babel-loader": "^8.3.0",
Expand Down
7 changes: 1 addition & 6 deletions frontend/src/app/AppLauncher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
import openshiftLogo from '~/images/openshift.svg';
import { useWatchConsoleLinks } from '~/utilities/useWatchConsoleLinks';
import { ODH_PRODUCT_NAME } from '~/utilities/const';
import { useAppSelector } from '~/redux/hooks';
import { getOpenShiftConsoleServerURL } from '~/utilities/clusterUtils';
import { useClusterInfo } from '~/redux/selectors/clusterInfo';
import { ApplicationAction, Section } from '~/types';
Expand Down Expand Up @@ -60,13 +59,9 @@ const sectionSortValue = (section: Section): number => {

const AppLauncher: React.FC = () => {
const [isOpen, setIsOpen] = React.useState(false);
const [clusterID, clusterBranding] = useAppSelector((state) => [
state.clusterID,
state.clusterBranding,
]);
const { clusterID, clusterBranding, serverURL } = useClusterInfo();
const { consoleLinks } = useWatchConsoleLinks();
const { dashboardConfig } = useAppContext();
const { serverURL } = useClusterInfo();

const disableClusterManager = dashboardConfig.spec.dashboardConfig.disableClusterManager;

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/redux/selectors/clusterInfo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { AppState } from '~/redux/types';
import { useAppSelector } from '~/redux/hooks';
import { isStateEqual } from '~/redux/selectors/utils';
import { ClusterState } from './types';

const getClusterInfo = (state: AppState): ClusterState => ({
Expand All @@ -8,4 +9,4 @@ const getClusterInfo = (state: AppState): ClusterState => ({
serverURL: state.serverURL,
});

export const useClusterInfo = (): ClusterState => useAppSelector(getClusterInfo);
export const useClusterInfo = (): ClusterState => useAppSelector(getClusterInfo, isStateEqual);
3 changes: 2 additions & 1 deletion frontend/src/redux/selectors/project.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useAppSelector } from '~/redux/hooks';
import { isStateEqual } from '~/redux/selectors/utils';
import { DashboardNamespace } from './types';

export const useDashboardNamespace = (): DashboardNamespace =>
useAppSelector((state) => ({ dashboardNamespace: state.dashboardNamespace || '' }));
useAppSelector((state) => ({ dashboardNamespace: state.dashboardNamespace || '' }), isStateEqual);
3 changes: 2 additions & 1 deletion frontend/src/redux/selectors/user.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { AppState } from '~/redux/types';
import { useAppSelector } from '~/redux/hooks';
import { isStateEqual } from '~/redux/selectors/utils';
import { UserState } from './types';

const getUser = (state: AppState): UserState => ({
Expand All @@ -10,4 +11,4 @@ const getUser = (state: AppState): UserState => ({
userError: state.userError ?? null,
});

export const useUser = (): UserState => useAppSelector(getUser);
export const useUser = (): UserState => useAppSelector(getUser, isStateEqual);
4 changes: 4 additions & 0 deletions frontend/src/redux/selectors/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { isEqual } from 'lodash-es';

export const isStateEqual = <T>(stateBefore: T, stateAfter: T): boolean =>
isEqual(stateBefore, stateAfter);

0 comments on commit c4c36d3

Please sign in to comment.