🐛 Fix invalid query calls when navigating away from poll

This commit is contained in:
Luke Vella 2023-08-09 10:37:39 +01:00
parent 1c44b3954b
commit c58c814786

View file

@ -287,6 +287,15 @@ const Prefetch = ({ children }: React.PropsWithChildren) => {
}; };
const PollLayout = ({ children }: React.PropsWithChildren) => { const PollLayout = ({ children }: React.PropsWithChildren) => {
const router = useRouter();
const urlId = router.query.urlId as string;
if (!urlId) {
// probably navigating away
return null;
}
return ( return (
<Prefetch> <Prefetch>
<LegacyPollContextProvider> <LegacyPollContextProvider>