[desktop] Allow refreshing when inside an album (#1827)
Steps to reproduce on Linux: - Open an album - Open a photo - View > Reload Causes a 404 page to be displayed.
This commit is contained in:
commit
1ee52c780f
|
@ -1,9 +1,3 @@
|
||||||
import { APPS } from "@ente/shared/apps/constants";
|
import Page from "@ente/shared/next/pages/404";
|
||||||
import NotFoundPage from "@ente/shared/next/pages/404";
|
|
||||||
import { AppContext } from "pages/_app";
|
|
||||||
import { useContext } from "react";
|
|
||||||
|
|
||||||
export default function NotFound() {
|
export default Page;
|
||||||
const appContext = useContext(AppContext);
|
|
||||||
return <NotFoundPage appContext={appContext} appName={APPS.AUTH} />;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
import { APPS } from "@ente/shared/apps/constants";
|
import Page from "@ente/shared/next/pages/404";
|
||||||
import NotFoundPage from "@ente/shared/next/pages/404";
|
|
||||||
import { AppContext } from "pages/_app";
|
|
||||||
import { useContext } from "react";
|
|
||||||
|
|
||||||
export default function NotFound() {
|
export default Page;
|
||||||
const appContext = useContext(AppContext);
|
|
||||||
return <NotFoundPage appContext={appContext} appName={APPS.AUTH} />;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,19 +1,30 @@
|
||||||
import { VerticallyCentered } from "@ente/shared/components/Container";
|
import { PAGES } from "@ente/accounts/constants/pages";
|
||||||
import { t } from "i18next";
|
import { useRouter } from "next/router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect } from "react";
|
||||||
|
|
||||||
import { PageProps } from "@ente/shared/apps/types";
|
const Page: React.FC = () => {
|
||||||
import EnteSpinner from "@ente/shared/components/EnteSpinner";
|
// [Note: 404 back to home]
|
||||||
|
//
|
||||||
|
// In the desktop app, if the user presses the refresh button when the URL
|
||||||
|
// has an attached query parameter, e.g. "/gallery?collectionId=xxx", then
|
||||||
|
// the code in next-electron-server blindly appends the html extension to
|
||||||
|
// this URL, resulting in it trying to open "gallery?collectionId=xxx.html"
|
||||||
|
// instead of "gallery.html". It doesn't find such a file, causing it open
|
||||||
|
// "404.html" (the static file generated from this file).
|
||||||
|
//
|
||||||
|
// One way around is to patch the package, e.g.
|
||||||
|
// https://github.com/ente-io/next-electron-server/pull/1/files
|
||||||
|
//
|
||||||
|
// However, redirecting back to the root is arguably a better fallback in
|
||||||
|
// all cases (even when running on our website), since our app is a SPA.
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
export default function NotFound({ appContext }: PageProps) {
|
|
||||||
const [loading, setLoading] = useState(true);
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
appContext.showNavBar(true);
|
router.push(PAGES.ROOT);
|
||||||
setLoading(false);
|
|
||||||
}, []);
|
}, []);
|
||||||
return (
|
|
||||||
<VerticallyCentered>
|
return <></>;
|
||||||
{loading ? <EnteSpinner /> : t("NOT_FOUND")}
|
};
|
||||||
</VerticallyCentered>
|
|
||||||
);
|
export default Page;
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue