From b5c676dbd453afde5b13dcd7215dfd8b8b665211 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Mon, 2 Dec 2024 12:28:51 -0300 Subject: [PATCH] fix: prevent infinity loop Signed-off-by: Vitor Mattos --- src/router/router.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/router/router.js b/src/router/router.js index a838c465a9..62237d17c8 100644 --- a/src/router/router.js +++ b/src/router/router.js @@ -205,22 +205,24 @@ const router = new Router({ }) router.beforeEach((to, from, next) => { + const actionElement = document.querySelector('#initial-state-libresign-action') + let action + if (actionElement) { + action = selectAction(loadState('libresign', 'action', ''), to, from) + document.querySelector('#initial-state-libresign-action')?.remove() + } if (Object.hasOwn(to, 'name') && typeof to.name === 'string' && !to.name.endsWith('External') && isExternal(to, from)) { next({ name: to.name + 'External', params: to.params, }) + } else if (action !== undefined) { + next({ + name: action, + params: to.params, + }) } else { - const action = selectAction(loadState('libresign', 'action', ''), to, from) - if (action !== undefined) { - document.querySelector('#initial-state-libresign-action').remove() - next({ - name: action, - params: to.params, - }) - } else { - next() - } + next() } })