From ffd46987ef09223b0be17318ddddeebf4afc611b Mon Sep 17 00:00:00 2001 From: Rick Terrill <179257+RickDT@users.noreply.github.com> Date: Thu, 5 Oct 2023 10:16:56 -0500 Subject: [PATCH] Improve code legibility a bit --- examples/react-webpack/src/index.js | 6 ++++-- packages/react/src/index.tsx | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/react-webpack/src/index.js b/examples/react-webpack/src/index.js index 69f016e..4e670ed 100644 --- a/examples/react-webpack/src/index.js +++ b/examples/react-webpack/src/index.js @@ -14,8 +14,10 @@ const ProfileBox = () => { useEffect(() => { // if the user is now connected, then fetch profile info - if (loginStatus?.status === 'connected') getProfile?.().then(setProfileResponse) - }, [loginStatus]) + if (loginStatus?.status === 'connected' && getProfile) { + getProfile().then(setProfileResponse) + } + }, [loginStatus, getProfile]) if (!profileResponse) return null diff --git a/packages/react/src/index.tsx b/packages/react/src/index.tsx index e05283f..32e0667 100644 --- a/packages/react/src/index.tsx +++ b/packages/react/src/index.tsx @@ -84,11 +84,11 @@ export const useParallel = () => { } // if we haven't loaded, return empty object - if (!parallel) + if (!parallel) { return { isLoaded: false, } - + } // React recreates elements on render/re-render, causing any children iframe elements // to reload their src attribute which causes a reload of the Parallel experience within // the iframe - which is a bad experience for users