未验证 提交 ff0571ae 编写于 作者: J Joe Haddad 提交者: GitHub

Remove unused router method (#16149)

This PR removes a legacy router method that was used for old-style HMR, now replaced by Fast Refresh.

This method was not public:
```tsx
export type NextRouter = BaseRouter &
  Pick<
    Router,
    | 'push'
    | 'replace'
    | 'reload'
    | 'back'
    | 'prefetch'
    | 'beforePopState'
    | 'events'
    | 'isFallback'
  >
```

Even if someone found this method, it's highly unlikely they could use it successfully—it required the full module object.
上级 c7acd118
......@@ -397,31 +397,6 @@ export default class Router implements BaseRouter {
this.change('replaceState', url, as, options)
}
update(route: string, mod: any) {
const Component: ComponentType = mod.default || mod
const data = this.components[route]
if (!data) {
throw new Error(`Cannot update unavailable route: ${route}`)
}
const newData = Object.assign({}, data, {
Component,
__N_SSG: mod.__N_SSG,
__N_SSP: mod.__N_SSP,
})
this.components[route] = newData
// pages/_app.js updated
if (route === '/_app') {
this.notify(this.components[this.route])
return
}
if (route === this.route) {
this.notify(newData)
}
}
reload(): void {
window.location.reload()
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册