Open
Description
Description
When using a raw history.pushState
or history.replaceState
call and either not passing a 3rd argument or passing an argument that doesn't parse to a valid URL, a runtime error occurs.
It seems like the code in navigator.js#createEventListeners
and navigator.js#runHooksBeforeUrlChange
are expecting that a url
argument will always be passed, when that's not actually the case.
Examples:
history.replaceState({}, "");
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'startsWith')
at parseUrl (index.js:120)
at urlToRoute (urlToRoute.js:12)
at runHooksBeforeUrlChange (navigator.js:124)
history.pushState({}, "", "");
Uncaught (in promise) TypeError: Failed to construct 'URL': Invalid URL
at parseUrl (index.js:121)
at urlToRoute (urlToRoute.js:12)
at runHooksBeforeUrlChange (navigator.js:124)
Package Versions
$ npm ls --depth=0 @roxi/routify svelte
[email protected] REDACTED
├── @roxi/[email protected]
└── [email protected]