From 5db40efba67dfd3c8d4e4edb505ccb20df9d92e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Netto?= <hi@joaonetto.me> Date: Wed, 2 Sep 2020 14:38:01 -0300 Subject: [PATCH] Fixes tracker code bug on handling pushState - Enforcing .toString() on navigatedURL, because without it it returns an object and break history state changes; - Typo `navaigatedUrl` to `navigatedURL`; --- tracker/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tracker/index.js b/tracker/index.js index f0ad78cd..52e09514 100644 --- a/tracker/index.js +++ b/tracker/index.js @@ -58,15 +58,15 @@ import { removeTrailingSlash } from '../lib/url'; /* Handle history */ - const handlePush = (state, title, navaigatedUrl) => { + const handlePush = (state, title, navigatedURL) => { removeEvents(); currentRef = currentUrl; - if (navaigatedUrl.startsWith('http')) { - const url = new URL(navaigatedUrl); + if (navigatedURL.toString().startsWith('http')) { + const url = new URL(navigatedURL.toString()); currentUrl = `${url.pathname}${url.search}`; } else { - currentUrl = navaigatedUrl; + currentUrl = navigatedURL.toString(); } pageView();