From 897dd578b8165bbc1022fb180fa3e8386538b0fd Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Tue, 13 Apr 2021 01:21:13 -0400 Subject: [PATCH] Fix URL changing to homepage on 404 --- js/src/common/Application.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/src/common/Application.js b/js/src/common/Application.js index c886a423a..feffc0f5a 100644 --- a/js/src/common/Application.js +++ b/js/src/common/Application.js @@ -24,6 +24,7 @@ import { flattenDeep } from 'lodash-es'; import PageState from './states/PageState'; import ModalManagerState from './states/ModalManagerState'; import AlertManagerState from './states/AlertManagerState'; +import ErrorPage from './components/ErrorPage'; /** * The `App` class provides a container for an application, as well as various @@ -199,6 +200,9 @@ export default class Application { this.drawer = new Drawer(); + // Needed so 404s don't get their URLs changed to the homepage. + // Won't affect extension routes since its added last. + this.routes.error = { path: '/:4xx...', component: ErrorPage }; m.route(document.getElementById('content'), basePath + '/', mapRoutes(this.routes, basePath)); // Add a class to the body which indicates that the page has been scrolled