Skip to content

Commit

Permalink
docs: don't throw error in docs app on localhost
Browse files Browse the repository at this point in the history
This is due to releases failing to load.
  • Loading branch information
chrisvxd committed May 13, 2024
1 parent 3e88607 commit e0448f0
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions apps/docs/components/ReleaseSwitcher/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,22 @@ export const ReleaseSwitcher = ({
]);

useEffect(() => {
fetch(`${BASE_URL}/api/releases`).then(async (res) => {
const { releases } = await res.json();
const releaseOptions = Object.keys(releases).map((key) => ({
label: key,
value: key,
}));
fetch(`${BASE_URL}/api/releases`)
.then(async (res) => {
const { releases } = await res.json();
const releaseOptions = Object.keys(releases).map((key) => ({
label: key,
value: key,
}));

releaseOptions[1].label = `${releaseOptions[1].label} (latest)`;
releaseOptions[1].value = ""; // Okay to set to "" because isLatest will be true for this release option
releaseOptions[1].label = `${releaseOptions[1].label} (latest)`;
releaseOptions[1].value = ""; // Okay to set to "" because isLatest will be true for this release option

setOptions(releaseOptions);
});
setOptions(releaseOptions);
})
.catch((e) => {
console.error(`Could not load releases: ${e}`);
});
}, []);

return (
Expand Down

0 comments on commit e0448f0

Please sign in to comment.