From 7ecd8094e2f0ceca8fb1486968aec3077a84ce6b Mon Sep 17 00:00:00 2001 From: Franzz Date: Thu, 11 Jun 2026 15:57:42 +0200 Subject: [PATCH] Fix back button -again- --- src/App.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/App.vue b/src/App.vue index 8708e79..4ea3fef 100644 --- a/src/App.vue +++ b/src/App.vue @@ -41,9 +41,7 @@ export default { this.updateMobile(); //Set initial page - let asInitHash = this.getBrowserHash(); - if(!asInitHash.page) asInitHash.page = this.consts.default_page; - this.setVarHash(asInitHash); + this.setVarHash(this.validateRoute(this.getBrowserHash())); }, mounted() { //Catch browser hash change @@ -51,7 +49,7 @@ export default { }, watch: { hashSnapshot(jNewHash, jOldHash) { - const asNewHash = JSON.parse(jNewHash); + const asNewHash = this.validateRoute(JSON.parse(jNewHash)); //Sync variable -> #hash if(asNewHash != this.getBrowserHash()) { @@ -97,6 +95,10 @@ export default { }, getPrevAnchor() { return this.getAnchor([this.hash.prev.page, ...this.hash.prev.items]); + }, + validateRoute(asHash) { + if(!Object.keys(aoRoutes).includes(asHash.page)) asHash.page = this.consts.default_page; + return asHash; } }, beforeUnmount() {