Skip to content

Commit 7668881

Browse files
authored
fix: Ensure user stays on same content page when switching doc versions (#1303)
1 parent ce3c1f8 commit 7668881

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/components/doc-version/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useCallback } from 'preact/hooks';
22
import { useLocation, useRoute } from 'preact-iso';
3-
import config from '../../config.json';
3+
import { docRoutes } from '../../lib/route-utils.js';
44
import style from './style.module.css';
55

66
export const LATEST_MAJOR = 'v10';
@@ -17,7 +17,7 @@ export default function DocVersion() {
1717
const onChange = useCallback(
1818
e => {
1919
const version = e.currentTarget.value;
20-
const url = config.docs[version]?.[name]
20+
const url = docRoutes[version]?.[`/${name}`]
2121
? path.replace(/(v\d{1,2})/, version)
2222
: `/guide/${version}/getting-started`;
2323
route(url);

0 commit comments

Comments
 (0)