diff --git a/client/src/templates/Challenges/utils/frame.js b/client/src/templates/Challenges/utils/frame.js index 9d612dea0f..def4a19df4 100644 --- a/client/src/templates/Challenges/utils/frame.js +++ b/client/src/templates/Challenges/utils/frame.js @@ -91,7 +91,8 @@ const mountFrame = }; const buildProxyConsole = proxyLogger => ctx => { - if (proxyLogger) { + // window does not exist if the preview is hidden, so we have to check. + if (proxyLogger && ctx?.window) { const oldLog = ctx.window.console.log.bind(ctx.window.console); ctx.window.console.log = function proxyConsole(...args) { proxyLogger(args.map(arg => format(arg)).join(' '));