feat: Handle returning to scoped importer search page
1 file changed, 11 insertions(+), 2 deletions(-)
changed files
M frontend/static/search.js → frontend/static/search.js
@@ -239,8 +239,10 @@ dialog.addEventListener("close", function () { detailsRange.deleteContents(); if (closedByPopstate) { closedByPopstate = false; - } else if (history.state?.detail) { - pageHistory.restore(history.state); + } else { + if (history.state?.detail) { + pageHistory.restore(history.state); + } pageHistory.push(pageHistory.state.url); } updateTitle(pageHistory.state.title, false);@@ -291,6 +293,13 @@ } if (dialog.open) { dialog.removeAttribute("open"); + + // If the dialog was open via js or via ssr + const closeLink = dialog.querySelector("a.button"); + if (closeLink) { + pageHistory.state.url = closeLink.href; + } + dialog.showModal(); }