Skip to content

Commit

Permalink
Merge pull request #330 from player-ui/docs/version-selector
Browse files Browse the repository at this point in the history
Version Selector Fixes
  • Loading branch information
KetanReddy authored Apr 10, 2024
2 parents e2ed0f7 + f6863c3 commit 6a00bdd
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion docs/site/components/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,21 @@ export const VersionSelector = () => {
}}
value={router.basePath || 'latest'}
onChange={(e) => {
router.push(`${DOCS_BASE_URL}/${e.target.value}`);
const currentRoute = router.pathname
.split('/')
.filter((s) => {
// filter out empty string and url elements that include the version
if (
s &&
!['latest', 'next', ...released.map((r) => r.path)].includes(s)
) {
return true;
}

return false;
})
.join('/');
router.push(`${DOCS_BASE_URL}${e.target.value}/${currentRoute}`);
}}
>
<option value="latest">Latest</option>
Expand Down

0 comments on commit 6a00bdd

Please sign in to comment.