Skip to content

Commit 885df6c

Browse files
committed
fix(html): point the version picker at the module page on section pages
Section pages exist only on the new site, so switching versions from /fs/callback-api gave a 404 on every release. The picker now also keeps the current version selected, so it no longer renders empty after going back. Signed-off-by: Nikhil Kumar Rajak <ryzrr.official@gmail.com>
1 parent 6a73fd2 commit 885df6c

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
@@ -109,12 +109,14 @@ const Sidebar = ({ metadata }) => {
109109
metadata.added ?? metadata.introduced_in
110110
);
111111

112+
const currentVersion = `v${version.version}`;
113+
112114
// Filter pre-computed versions by compatibility and resolve per-page URL
113115
const compatibleVersions = versions
114116
.filter(v => v.major >= introducedMajor)
115-
.map(({ url, label }) => ({
116-
value: url.replace('{path}', metadata.path),
117-
label,
117+
.map(({ url, label, major }) => ({
118+
value: url.replace('{path}', metadata.chunk?.path ?? metadata.path),
119+
label: major === version.major ? currentVersion : label,
118120
}));
119121

120122
return (
@@ -131,9 +133,12 @@ const Sidebar = ({ metadata }) => {
131133
<Select
132134
label={`${project} version`}
133135
values={compatibleVersions}
136+
value={
137+
compatibleVersions.find(v => v.label === currentVersion)?.value
138+
}
134139
inline={true}
135140
className={styles.select}
136-
placeholder={`v${version.version}`}
141+
placeholder={currentVersion}
137142
onChange={redirect}
138143
/>
139144
</div>

0 commit comments

Comments
 (0)