Skip to content

Commit

Permalink
Fix version selector for parity with previous version
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Provost <[email protected]>
  • Loading branch information
BSFishy committed Jan 11, 2024
1 parent 6ef0c94 commit dbb4e8c
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const GuideVersionSelector: FunctionComponent<GuideVersionSelectorProps>

closePopover();
setSelectedOption(value);
window.location.href = `/${value}`;
window.location.href = `/${value}/`;
},
[]
);
Expand All @@ -57,14 +57,17 @@ export const GuideVersionSelector: FunctionComponent<GuideVersionSelectorProps>

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]);
Expand All @@ -75,7 +78,7 @@ export const GuideVersionSelector: FunctionComponent<GuideVersionSelectorProps>
<OuiContextMenuItem
key={option}
icon={option === selectedOption ? 'check' : 'empty'}
href={`/${option}`}
href={`/${option}/`}
onClick={onChange(option)}>
<OuiFlexGroup direction="row" wrap={false}>
<OuiFlexItem>v{option}</OuiFlexItem>
Expand Down

0 comments on commit dbb4e8c

Please sign in to comment.