Skip to content

Commit

Permalink
Try to handle context not defined in page panel
Browse files Browse the repository at this point in the history
I wonder if this is caused by server-side rendering?
  • Loading branch information
jonathansick committed Mar 28, 2024
1 parent 0656660 commit 2edd58a
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 <p>Loading</p>;
}

const pageData = useTimesSquarePage(tsPageUrl);

if (pageData.loading) {
Expand Down

0 comments on commit 2edd58a

Please sign in to comment.