Skip to content

Commit 73f08d4

Browse files
authored
fix(html): fix the version picker on section pages and it blank state (#1112)
Signed-off-by: Nikhil Kumar Rajak <ryzrr.official@gmail.com>
1 parent afed64d commit 73f08d4

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

  • packages/react/src/html/ui/components/SideBar

‎packages/react/src/html/ui/components/SideBar/index.jsx‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,14 @@ const Sidebar = ({ metadata }) => {
114114
const remote = useRemoteConfig();
115115
const availableVersions = remote?.versions ?? versions;
116116

117+
const currentVersion = `v${version.version}`;
118+
117119
// Filter versions by compatibility and resolve per-page URL
118120
const compatibleVersions = availableVersions
119121
.filter(v => v.major >= introducedMajor)
120-
.map(({ url, label }) => ({
121-
value: url.replace('{path}', metadata.path),
122-
label,
122+
.map(({ url, label, major }) => ({
123+
value: url.replace('{path}', metadata.chunk?.path ?? metadata.path),
124+
label: major === version.major ? currentVersion : label,
123125
}));
124126

125127
return (
@@ -136,9 +138,12 @@ const Sidebar = ({ metadata }) => {
136138
<Select
137139
label={`${project} version`}
138140
values={compatibleVersions}
141+
value={
142+
compatibleVersions.find(v => v.label === currentVersion)?.value
143+
}
139144
inline={true}
140145
className={styles.select}
141-
placeholder={`v${version.version}`}
146+
placeholder={currentVersion}
142147
onChange={redirect}
143148
/>
144149
</div>

0 commit comments

Comments
 (0)