mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-01-11 22:40:31 +00:00
Router uses emptystring as default for pathname
This commit is contained in:
parent
ab9df74ff0
commit
0eaaad35b1
1 changed files with 3 additions and 6 deletions
|
|
@ -18,11 +18,8 @@ const Router = ({ className, onPathNotMatch, ...props }) => {
|
|||
const onLocationHashChange = () => {
|
||||
const { pathname, query } = UrlUtils.parse(window.location.hash.slice(1));
|
||||
const queryParams = new URLSearchParams(typeof query === 'string' ? query : '');
|
||||
const routeConfig = typeof pathname === 'string' ?
|
||||
routeConfigForPath(viewsConfig, pathname)
|
||||
:
|
||||
null;
|
||||
if (!routeConfig) {
|
||||
const routeConfig = routeConfigForPath(viewsConfig, typeof pathname === 'string' ? pathname : '');
|
||||
if (routeConfig === null) {
|
||||
if (typeof onPathNotMatch === 'function') {
|
||||
const component = onPathNotMatch();
|
||||
if (ReactIs.isValidElementType(component)) {
|
||||
|
|
@ -40,7 +37,7 @@ const Router = ({ className, onPathNotMatch, ...props }) => {
|
|||
return;
|
||||
}
|
||||
|
||||
const urlParams = urlParamsForPath(routeConfig, pathname);
|
||||
const urlParams = urlParamsForPath(routeConfig, typeof pathname === 'string' ? pathname : '');
|
||||
const routeViewIndex = viewsConfig.findIndex((vc) => vc.includes(routeConfig));
|
||||
const routeIndex = viewsConfig[routeViewIndex].findIndex((rc) => rc === routeConfig);
|
||||
setViews((views) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue