From dbb4e8c3edadfcb7b3d5086a99fdb1c13dda0ff0 Mon Sep 17 00:00:00 2001 From: Matt Provost Date: Thu, 11 Jan 2024 17:15:19 +0000 Subject: [PATCH] Fix version selector for parity with previous version Signed-off-by: Matt Provost --- .../guide_version_selector.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src-docs/src/components/guide_version_selector/guide_version_selector.tsx b/src-docs/src/components/guide_version_selector/guide_version_selector.tsx index 302708d0ac..58159166fc 100644 --- a/src-docs/src/components/guide_version_selector/guide_version_selector.tsx +++ b/src-docs/src/components/guide_version_selector/guide_version_selector.tsx @@ -45,7 +45,7 @@ export const GuideVersionSelector: FunctionComponent closePopover(); setSelectedOption(value); - window.location.href = `/${value}`; + window.location.href = `/${value}/`; }, [] ); @@ -57,14 +57,17 @@ export const GuideVersionSelector: FunctionComponent fetch('/versions.json') .then((response) => { - if (!response.ok) { - return Promise.reject(response.text()); - } + return new Promise((resolve, reject) => { + if (!response.ok) { + response.text().then(reject); + return; + } - return response.json(); + response.json().then(resolve); + }); }) - .then((branches: string[]) => { - setOptions(branches); + .then((branches) => { + setOptions(branches as string[]); }) .catch(console.error); }, [isLocalDev]); @@ -75,7 +78,7 @@ export const GuideVersionSelector: FunctionComponent v{option}