From 52216fc1d6dc3bf2d438f83630f5e42e245e29ed Mon Sep 17 00:00:00 2001 From: "Erin E. Sullivan" Date: Thu, 14 Nov 2024 14:52:52 -0500 Subject: [PATCH] Removing unused `profile` properties, and destructuring `profile` state. --- src/modules/datastores/components/FlintAlerts/index.js | 6 +++--- src/modules/pages/components/DatastorePage/index.js | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/modules/datastores/components/FlintAlerts/index.js b/src/modules/datastores/components/FlintAlerts/index.js index 5d52c17d..ba7b8b49 100644 --- a/src/modules/datastores/components/FlintAlerts/index.js +++ b/src/modules/datastores/components/FlintAlerts/index.js @@ -2,7 +2,7 @@ import { Alert, Anchor } from '../../../reusable'; import React, { useState } from 'react'; import PropTypes from 'prop-types'; -const FlintAlerts = ({ datastore, profile }) => { +const FlintAlerts = ({ datastore, institutions = [] }) => { const [dismiss, setDismiss] = useState([]); const handleDismissClick = () => { setDismiss((previousDismiss) => { @@ -16,7 +16,7 @@ const FlintAlerts = ({ datastore, profile }) => { website: (<>We noticed you are affiliated with U-M Flint. For the best results use the Thompson Library website.) }; - if (!Object.keys(messages).includes(datastore) || !profile.institutions?.includes('Flint') || dismiss.includes(datastore)) { + if (!Object.keys(messages).includes(datastore) || !institutions.includes('Flint') || dismiss.includes(datastore)) { return null; } @@ -37,7 +37,7 @@ const FlintAlerts = ({ datastore, profile }) => { FlintAlerts.propTypes = { datastore: PropTypes.string, - profile: PropTypes.object + institutions: PropTypes.array }; export default FlintAlerts; diff --git a/src/modules/pages/components/DatastorePage/index.js b/src/modules/pages/components/DatastorePage/index.js index 786627f3..69336999 100644 --- a/src/modules/pages/components/DatastorePage/index.js +++ b/src/modules/pages/components/DatastorePage/index.js @@ -37,8 +37,8 @@ const DatastorePage = () => { const institution = useSelector((state) => { return state.institution; }); - const profile = useSelector((state) => { - return state.profile; + const { institutions } = useSelector((state) => { + return state.profile || {}; }); const search = useSelector((state) => { return state.search; @@ -94,7 +94,7 @@ const DatastorePage = () => { <> - + { /> } + element={} />