Skip to content

Commit e8d1e68

Browse files
authored
fix: make redirection work when page is not existing in previous version (#1350)
* fake whitespace for test * fix: log the redirection url * fix: remove api * docs: prevent people from removing the log * fix: use preventdefault instead of a return statement
1 parent cb23a7a commit e8d1e68

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,8 @@ function checkPageExistsAndRedirect(event) {
299299
location.href = otherDocsHomepage;
300300
});
301301

302-
// this prevents the browser from following the href of the clicked node
303-
// (which is fine because this function takes care of redirecting)
304-
return false;
302+
// ensure we don't follow the initial link
303+
event.preventDefault();
305304
}
306305

307306
/**
@@ -337,6 +336,7 @@ async function fetchVersionSwitcherJSON(url) {
337336
var versionSwitcherBtns = document.querySelectorAll(
338337
".version-switcher__button"
339338
);
339+
340340
if (versionSwitcherBtns.length) {
341341
const data = await fetchVersionSwitcherJSON(
342342
DOCUMENTATION_OPTIONS.theme_switcher_json_url

0 commit comments

Comments
 (0)