Home page hack: discard NextJS router state

This commit is contained in:
James Grugett 2022-08-15 11:06:42 -05:00
parent 972f215f0c
commit c80f82a3f7

View File

@ -101,13 +101,19 @@ const useContractPage = () => {
window.history.pushState = function () { window.history.pushState = function () {
// eslint-disable-next-line prefer-rest-params // eslint-disable-next-line prefer-rest-params
pushState.apply(history, arguments as any) const args = [...(arguments as any)] as any
// Discard NextJS router state.
args[0] = null
pushState.apply(history, args)
updateContract() updateContract()
} }
window.history.replaceState = function () { window.history.replaceState = function () {
// eslint-disable-next-line prefer-rest-params // eslint-disable-next-line prefer-rest-params
replaceState.apply(history, arguments as any) const args = [...(arguments as any)] as any
// Discard NextJS router state.
args[0] = null
replaceState.apply(history, args)
updateContract() updateContract()
} }