Fix pathname comparison while served on subpath
This commit is contained in:
@@ -21,6 +21,7 @@ import { useMetadataServerSettings } from '@/features/settings/services/ServerSe
|
||||
import { useLocalStorage } from '@/base/hooks/useStorage.tsx';
|
||||
import { AppRoutes } from '@/base/AppRoute.constants.ts';
|
||||
import { STABLE_EMPTY_OBJECT } from '@/base/Base.constants.ts';
|
||||
import { SubpathUtil } from '@/lib/utils/SubpathUtil.ts';
|
||||
|
||||
const disabledUpdateCheck = () => Promise.resolve();
|
||||
|
||||
@@ -92,7 +93,7 @@ export const ServerUpdateChecker = () => {
|
||||
return null;
|
||||
}
|
||||
|
||||
const isAboutPage = window.location.pathname === AppRoutes.about.path;
|
||||
const isAboutPage = SubpathUtil.getPathname() === AppRoutes.about.path;
|
||||
if (isAboutPage) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -19,13 +19,14 @@ import { BrowseTab } from '@/features/browse/Browse.types.ts';
|
||||
import { useAppPageHistoryContext } from '@/base/contexts/AppPageHistoryContext.tsx';
|
||||
import { useEffect } from 'react';
|
||||
import { ReactRouter } from '@/lib/react-router/ReactRouter.ts';
|
||||
import { SubpathUtil } from '@/lib/utils/SubpathUtil.ts';
|
||||
|
||||
export const Migration = ({ tabsMenuHeight = 0 }: { tabsMenuHeight?: number }) => {
|
||||
const phase = MigrationManager.usePhase();
|
||||
const { setOnBack } = useAppPageHistoryContext();
|
||||
|
||||
useEffect(() => {
|
||||
if (window.location.pathname !== AppRoutes.migrate.path) {
|
||||
if (SubpathUtil.getPathname() !== AppRoutes.migrate.path) {
|
||||
if (!MigrationManager.isActive()) {
|
||||
MigrationManager.reset();
|
||||
} else {
|
||||
|
||||
@@ -44,4 +44,10 @@ export class SubpathUtil {
|
||||
|
||||
return `${baseUrl}${subpath}`;
|
||||
}
|
||||
|
||||
public static getPathname(): string {
|
||||
const subpath = this.getSubpath();
|
||||
|
||||
return window.location.pathname.replace(subpath, '');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user