aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-12-01 05:34:03 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-12-01 05:34:03 +0800
commit9ebe8d63c829ea4b6b1fbbdf7a132c7f9b8f56dc (patch)
tree862c1f47f68c6fd5de2d1c8224a554c899449e2b
parentf496096ce154e51ae0317cc91fd55d062eb6ec4f (diff)
downloaddexon-0x-contracts-9ebe8d63c829ea4b6b1fbbdf7a132c7f9b8f56dc.tar
dexon-0x-contracts-9ebe8d63c829ea4b6b1fbbdf7a132c7f9b8f56dc.tar.gz
dexon-0x-contracts-9ebe8d63c829ea4b6b1fbbdf7a132c7f9b8f56dc.tar.bz2
dexon-0x-contracts-9ebe8d63c829ea4b6b1fbbdf7a132c7f9b8f56dc.tar.lz
dexon-0x-contracts-9ebe8d63c829ea4b6b1fbbdf7a132c7f9b8f56dc.tar.xz
dexon-0x-contracts-9ebe8d63c829ea4b6b1fbbdf7a132c7f9b8f56dc.tar.zst
dexon-0x-contracts-9ebe8d63c829ea4b6b1fbbdf7a132c7f9b8f56dc.zip
fix: push to history edge case for second render where onpopstate is not defined on first render
-rw-r--r--packages/instant/src/index.umd.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/instant/src/index.umd.ts b/packages/instant/src/index.umd.ts
index 95080f829..869b52353 100644
--- a/packages/instant/src/index.umd.ts
+++ b/packages/instant/src/index.umd.ts
@@ -91,10 +91,11 @@ export const render = (config: ZeroExInstantConfig, selector: string = DEFAULT_Z
const anyWindow = window as any;
if (window.onpopstate && !anyWindow.__zeroExInstantIntegratorsPopStateHandler) {
anyWindow.__zeroExInstantIntegratorsPopStateHandler = window.onpopstate.bind(window);
+ } else {
+ anyWindow.__zeroExInstantIntegratorsPopStateHandler = util.boundNoop;
}
- const integratorsOnPopStateHandler = anyWindow.__zeroExInstantIntegratorsPopStateHandler || util.boundNoop;
const onPopStateHandler = (e: PopStateEvent) => {
- integratorsOnPopStateHandler(e);
+ anyWindow.__zeroExInstantIntegratorsPopStateHandler(e);
const newState = e.state;
if (newState && newState.zeroExInstantShowing) {
// We have returned to a history state that expects instant to be rendered.