未验证 提交 c685b9b0 编写于 作者: J JJ Kasper 提交者: GitHub

Apply workaround for Firefox bug (#6630)

* Apply workaround for Firefox bug
and shallow routing

* Update to only apply workaround when needed

* Add TODO for future removal
Co-Authored-By: Nijjk <22380829+ijjk@users.noreply.github.com>
上级 e5636dcd
/* global __NEXT_DATA__ */
/* global __NEXT_DATA__, location */
import { parse } from 'url'
import mitt from '../mitt'
......@@ -40,6 +40,16 @@ export default class Router {
this.changeState('replaceState', formatWithValidation({ pathname, query }), as)
window.addEventListener('popstate', this.onPopState)
// Workaround for weird Firefox bug, see below links
// https://github.com/zeit/next.js/issues/3817
// https://bugzilla.mozilla.org/show_bug.cgi?id=1422334
// TODO: let's remove this once the Firefox bug is resolved
if (navigator.userAgent && navigator.userAgent.match(/firefox/i)) {
window.addEventListener('unload', () => {
if (location.search) location.replace(location)
})
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册