Commit 1ae3c2e6 authored by Arunoda Susiripala's avatar Arunoda Susiripala Committed by GitHub

Ping to on-demand-entries on every page change. (#1384)

This will prevent disposing the page after viewing it.
Otherwise, it'll possible to dispose the page even
we load the page on the client.
parent 0d01f5c8
...@@ -3,6 +3,12 @@ ...@@ -3,6 +3,12 @@
import Router from '../lib/router' import Router from '../lib/router'
import fetch from 'unfetch' import fetch from 'unfetch'
const originalRouteChangeComplete = Router.onRouteChangeComplete
Router.onRouteChangeComplete = (...args) => {
if (originalRouteChangeComplete) originalRouteChangeComplete(...args)
ping()
}
async function ping () { async function ping () {
try { try {
const url = `/_next/on-demand-entries-ping?page=${Router.pathname}` const url = `/_next/on-demand-entries-ping?page=${Router.pathname}`
......
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