Skip to content

Commit

Permalink
Fix window undefined (#6236)
Browse files Browse the repository at this point in the history
  • Loading branch information
gewfy authored Nov 7, 2024
2 parents e6ffeb8 + aa0b381 commit 202b778
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,16 @@ export default function ExerciseHostNotes() {
}, []);

useEffect(() => {
window.opener?.addEventListener('message', receiveMessage);
window.opener?.postMessage({
window?.opener?.addEventListener('message', receiveMessage);
window?.opener?.postMessage({
type: 'sessionControls',
payload: {type: 'init'},
});
return () => window.opener?.removeEventListener('message', receiveMessage);
}, [receiveMessage]);

if (!window.opener || !state.exercise) return null;
if (typeof window == 'undefined' || !window.opener || !state.exercise)
return null;

return (
<Wrapper>
Expand Down

0 comments on commit 202b778

Please sign in to comment.