Replace history entry if current route is null
This commit is contained in:
parent
049e9a1680
commit
9051861f4d
@ -127,7 +127,14 @@ function initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function navigate(routeName, params = {}) {
|
function navigate(routeName, params = {}) {
|
||||||
router.push({name: routeName, params}).catch(() => {});
|
if (router.currentRoute.name) {
|
||||||
|
router.push({name: routeName, params}).catch(() => {});
|
||||||
|
} else {
|
||||||
|
// If current route is null, replace the history entry
|
||||||
|
// This prevents invalid entries from lingering in history,
|
||||||
|
// and then the route guard preventing proper navigation
|
||||||
|
router.replace({name: routeName, params}).catch(() => {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function switchToChannel(channel) {
|
function switchToChannel(channel) {
|
||||||
|
@ -71,9 +71,8 @@ store.watch(
|
|||||||
(sidebarOpen) => {
|
(sidebarOpen) => {
|
||||||
if (window.outerWidth > constants.mobileViewportPixels) {
|
if (window.outerWidth > constants.mobileViewportPixels) {
|
||||||
storage.set("thelounge.state.sidebar", sidebarOpen);
|
storage.set("thelounge.state.sidebar", sidebarOpen);
|
||||||
|
vueApp.$emit("resize");
|
||||||
}
|
}
|
||||||
|
|
||||||
vueApp.$emit("resize");
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user