Skip to content

Commit

Permalink
Prevent Sidebar to redirect from /latest/ to the /<version>/ in api
Browse files Browse the repository at this point in the history
pages.

Looks like the component now triggers the selected and changed event on
render.
  • Loading branch information
fabianrbz committed Oct 3, 2024
1 parent d0313c2 commit df3aa41
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/_assets/javascripts/components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ function onSelectedVersion (event) {
}
const currentPath = window.location.pathname;
let versionSegment = versionToRelease(version.name);
const latestVersion = props.product.latest_version.name;
if (version.name === latestVersion && currentPath.includes('/latest/')) {
return;
}
let newPathname = currentPath.split('/').slice(0, -2).concat(versionSegment).join('/').concat('/')
if (newPathname !== window.location.pathname) {
Expand Down

0 comments on commit df3aa41

Please sign in to comment.