Commit 71ae456a authored by JJ Kasper's avatar JJ Kasper Committed by Tim Neutkens

Fix invalid ping response throwing error in client (#6397)

parent e0896e5d
......@@ -34,6 +34,7 @@ export default async ({ assetPrefix }) => {
}
evtSource.onmessage = event => {
try {
const payload = JSON.parse(event.data)
if (payload.invalid) {
// Payload can be invalid even if the page does not exist.
......@@ -46,6 +47,7 @@ export default async ({ assetPrefix }) => {
}
})
}
} catch (_) { /* noop */ }
}
}
......
......@@ -303,6 +303,7 @@ export default function onDemandEntryHandler (devMiddleware, multiCompiler, {
const runPing = () => {
const data = handlePing(query.page)
if (!data) return
res.write('data: ' + JSON.stringify(data) + '\n\n')
}
const pingInterval = setInterval(() => runPing(), 5000)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment