From 5e94b1a71e862a4f26a64ac4a18b229f6dcdc9a7 Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Fri, 19 Jul 2024 15:50:09 -0400 Subject: [PATCH 1/2] - Improve product fruits wrapper for extra checks Signed-off-by: Dave Richer --- client/src/App/App.jsx | 9 ++++++++- client/src/App/ProductFruitsWrapper.jsx | 10 +++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/client/src/App/App.jsx b/client/src/App/App.jsx index 1864bd623..441359097 100644 --- a/client/src/App/App.jsx +++ b/client/src/App/App.jsx @@ -142,7 +142,14 @@ export function App({ bodyshop, checkUserSession, currentUser, online, setOnline /> } > - + { +const ProductFruitsWrapper = React.memo(({ currentUser, workspaceCode }) => { return ( + workspaceCode && currentUser?.authorized === true && currentUser?.email && ( Date: Fri, 19 Jul 2024 16:01:40 -0400 Subject: [PATCH 2/2] - Add Prop Types to ProductFruitsWrapper.jsx Signed-off-by: Dave Richer --- client/src/App/ProductFruitsWrapper.jsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/src/App/ProductFruitsWrapper.jsx b/client/src/App/ProductFruitsWrapper.jsx index 4f6ca5dc8..2d3cfbac7 100644 --- a/client/src/App/ProductFruitsWrapper.jsx +++ b/client/src/App/ProductFruitsWrapper.jsx @@ -1,5 +1,6 @@ import React from "react"; import { ProductFruits } from "react-product-fruits"; +import PropTypes from "prop-types"; const ProductFruitsWrapper = React.memo(({ currentUser, workspaceCode }) => { return ( @@ -21,3 +22,11 @@ const ProductFruitsWrapper = React.memo(({ currentUser, workspaceCode }) => { }); export default ProductFruitsWrapper; + +ProductFruitsWrapper.propTypes = { + currentUser: PropTypes.shape({ + authorized: PropTypes.bool, + email: PropTypes.string + }).isRequired, + workspaceCode: PropTypes.string.isRequired +};