Skip to content

Commit

Permalink
fix: prevent infinity loop
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Mattos <[email protected]>
  • Loading branch information
vitormattos authored and backportbot-libresign[bot] committed Dec 2, 2024
1 parent f39371d commit b5c676d
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/router/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
})

Expand Down

0 comments on commit b5c676d

Please sign in to comment.