fix(docs): version-picker shows selected option on /versions/latest/ (#238) - #247
Merged
Merged
Conversation
Bug: the dropdown on /versions/latest/ showed no selected option, because
the picker's URL-match resolution block at renderPicker() lines 59-84 tried
to match `latest`'s URL (/versions/latest/) against concrete version URLs
(/versions/vX.Y.Z/) — structurally different, so the match NEVER succeeded.
The picker then fell through to the render loop, which unconditionally
skipped the `latest` entry, leaving no option matching `currentVersion`.
The browser then auto-selected the first option but change wouldn't fire,
so the user couldn't navigate away.
Fix (Option 1 from the issue): keep `latest` as a first-class option on
/versions/latest/, drop the dead URL-match resolution block entirely.
Changes:
- Delete the 26-line URL-match resolution block that was chasing an
impossible match. Add a note at the currentVersion default explaining
that `latest` is the fallback for pages that aren't under /versions/.
- Change the render-loop skip from unconditional
if (v.version === 'latest') return;
to conditional
if (v.version === 'latest' && currentVersion !== 'latest') return;
so `latest` shows up as a selectable option ONLY when the reader is on
/versions/latest/. On concrete-version pages the skip still applies —
no redundant `latest + vX.Y.Z` pair.
Verified locally via an HTML harness that:
- On /versions/latest/ → dropdown shows [latest, v0.3.4, v0.3.3, v0.3.2], `latest` selected.
- On /versions/v0.3.4/ → dropdown shows [v0.3.4, v0.3.3, v0.3.2], v0.3.4 selected.
- On /versions/v0.3.2/ → dropdown shows [v0.3.4, v0.3.3, v0.3.2], v0.3.2 selected.
- On any non-/versions/ page → currentVersion defaults to 'latest'; dropdown shows all
with `latest` selected.
- change event fires and navigates when a version is picked.
Fleet-wide: version-picker.js was fanned out from the canonical during the
D8 campaign; every downstream Wolfgang.* docs site has the same broken
block. A fan-out of this fix belongs in the next `bulk-repo-pr` sweep —
noted in the InspectCode/docs rollout memory.
Closes #238
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the DocFX docs-site version dropdown so it correctly shows a selected option when users land on /versions/latest/, aligning behavior with issue #238’s acceptance criteria by removing unreachable “latest alias resolution” logic and rendering latest only when appropriate.
Changes:
- Removed the dead URL-match “latest → concrete version” resolution block that could never succeed.
- Updated dropdown rendering to include the
latestoption only when the current page is/versions/latest/, ensuring the selected option is visible and navigation remains functional.
3 tasks
This was referenced Jul 14, 2026
Merged
Merged
fix(docs): version-picker shows selected option on /versions/latest/
Chris-Wolfgang/ETL-Test-Kit#204
Merged
Merged
fix(docs): version-picker shows selected option on /versions/latest/
Chris-Wolfgang/Etl-DbClient#247
Merged
Chris-Wolfgang
added a commit
to Chris-Wolfgang/DbContextBuilder
that referenced
this pull request
Jul 26, 2026
…369) ## Summary Fan-out of [Try-Pattern PR #247](Chris-Wolfgang/Try-Pattern#247). The version-picker JS had a dead URL-match resolution block that tried to match the `latest` alias URL (`/<repo>/versions/latest/`) against concrete version URLs (`/<repo>/versions/vX.Y.Z/`) — structurally different by construction, so the match NEVER succeeded. The render loop then unconditionally skipped the `latest` entry, leaving no option selected on `/versions/latest/`. **Fix:** delete the dead resolution block; keep `latest` as a first-class option ONLY when the reader is on `/versions/latest/`. On concrete-version pages the skip still applies — no redundant `latest + vX.Y.Z` pair. Same patch, same file. Direct fan-out of Try-Pattern's canonical. ## Verification Try-Pattern PR verified via HTML harness across 4 URL cases; change event fires and navigates correctly. See [Try-Pattern #247](Chris-Wolfgang/Try-Pattern#247) for details. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This was referenced Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #238 — the docs-site version dropdown showed no selected option when readers landed on
/versions/latest/.Root cause
docfx_project/public/version-picker.jshad a 26-line URL-match "resolution" block that tried to reconcile thelatestalias against a concretevX.Y.Zentry by matching URLs. Those URLs are structurally different by construction —latest's URL is/<repo>/versions/latest/while concrete entries are/<repo>/versions/vX.Y.Z/— so the match NEVER succeeded. The picker then fell through to the render loop, which unconditionally skipped thelatestentry, leaving no option matchingcurrentVersion === 'latest'. The browser auto-selected the first option, butchangedidn't fire because the value was already there → the user couldn't navigate anywhere via the picker.Fix (Option 1 from the issue)
latestshows up as a selectable option only when the reader is on/versions/latest/. On concrete-version pages the skip still applies — no redundantlatest + vX.Y.Zpair.-34 / +12— mostly deletion.Verification
Ran a self-contained HTML harness against the patched JS with mocked
versions.json:/versions/latest/[latest, v0.3.4, v0.3.3, v0.3.2]latest✅ (was broken before — no selection)/versions/v0.3.4/[v0.3.4, v0.3.3, v0.3.2]v0.3.4✅/versions/v0.3.2/[v0.3.4, v0.3.3, v0.3.2]v0.3.2✅[latest, v0.3.4, v0.3.3, v0.3.2]latest✅ (default)Change event fires and navigates when a version is picked (verified — dispatching
changecaused the browser tab to try to navigate).Fleet-wide
version-picker.jswas fanned out from the canonical during the D8 campaign, so every downstream Wolfgang.* docs site has the same broken block. Nextbulk-repo-prsweep should apply this same delete-and-flip patch to all 12 sibling repos plusrepo-template.Closes #238