From 4ae7ad35fffd9804362b423e18c4cc73af8fc5df Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Thu, 10 Sep 2020 21:12:04 -0700 Subject: [PATCH] Update url checking logic. --- tracker/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tracker/index.js b/tracker/index.js index 9a5051b8..f7f00927 100644 --- a/tracker/index.js +++ b/tracker/index.js @@ -58,14 +58,14 @@ import { removeTrailingSlash } from '../lib/url'; /* Handle history */ - const handlePush = (state, title, navigatedURL) => { + const handlePush = (state, title, url) => { removeEvents(); currentRef = currentUrl; - const newUrl = navigatedURL.toString(); + const newUrl = url.toString(); - if (newUrl.startsWith('http')) { - const url = new URL(newUrl); - currentUrl = `${url.pathname}${url.search}`; + if (newUrl.substring(0, 4) === 'http') { + const { pathname, search } = new URL(newUrl); + currentUrl = `${pathname}${search}`; } else { currentUrl = newUrl; }