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`;
This commit is contained in:
João Pedro Netto 2020-09-02 14:38:01 -03:00 committed by GitHub
parent 80c3927048
commit 5db40efba6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -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();