mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
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.
This commit is contained in:
parent
0d01f5c8e8
commit
1ae3c2e637
|
@ -3,6 +3,12 @@
|
|||
import Router from '../lib/router'
|
||||
import fetch from 'unfetch'
|
||||
|
||||
const originalRouteChangeComplete = Router.onRouteChangeComplete
|
||||
Router.onRouteChangeComplete = (...args) => {
|
||||
if (originalRouteChangeComplete) originalRouteChangeComplete(...args)
|
||||
ping()
|
||||
}
|
||||
|
||||
async function ping () {
|
||||
try {
|
||||
const url = `/_next/on-demand-entries-ping?page=${Router.pathname}`
|
||||
|
|
Loading…
Reference in a new issue