From 2edd58a83ce3fc0586efb3c65d8237c1b4a65673 Mon Sep 17 00:00:00 2001 From: Jonathan Sick Date: Thu, 28 Mar 2024 13:46:21 -0400 Subject: [PATCH] Try to handle context not defined in page panel I wonder if this is caused by server-side rendering? --- .../TimesSquareGitHubPagePanel.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/squareone/src/components/TimesSquareGitHubPagePanel/TimesSquareGitHubPagePanel.js b/apps/squareone/src/components/TimesSquareGitHubPagePanel/TimesSquareGitHubPagePanel.js index 7b96484f..ee3c384a 100644 --- a/apps/squareone/src/components/TimesSquareGitHubPagePanel/TimesSquareGitHubPagePanel.js +++ b/apps/squareone/src/components/TimesSquareGitHubPagePanel/TimesSquareGitHubPagePanel.js @@ -16,7 +16,13 @@ import TimesSquareUrlParametersContext from '../TimesSquareUrlParametersProvider export default function TimesSquareGitHubPagePanel({}) { const { publicRuntimeConfig } = getConfig(); - const { tsPageUrl } = React.useContext(TimesSquareUrlParametersContext); + const parameters = React.useContext(TimesSquareUrlParametersContext); + // test if parameters is undefined + const tsPageUrl = parameters ? parameters.tsPageUrl : null; + if (!tsPageUrl) { + return

Loading

; + } + const pageData = useTimesSquarePage(tsPageUrl); if (pageData.loading) {