Hide prereleases and branch builds in the version picker (fixes #128) #142
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
qwc-open/asiakirjat!142
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/hide-prereleases"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #128. Independent of #140 — different files, either merge order works. The issue had no body, so here's my reading; say the word if you meant it differently.
Interpretation
The documentation top bar gains an All checkbox, unticked by default. Unticked, the version picker lists only stable releases; ticked, it lists everything. The choice is remembered in
localStorage, so it persists as the reader moves between pages.Stable means digits and dots after an optional
v—1.4,v2.0.0. Anything with a suffix (v2.0.0-rc1,1.0-beta,2.1.dev0) or a name (main,feature-login) is treated as a prerelease or branch build and hidden.I deliberately used a stricter rule than the server's
docs.IsSemver, which matchesv1.2.3-rc1too — that regex exists for sorting, where prereleases must still sort as versions, so reusing it here would have hidden nothing.Two cases that keep it honest
/project/x/v2.0.0-rc1/would leave the picker unable to show the page you're on.main.The Compare dropdown follows the same filter and keeps whatever version is currently selected visible, so toggling the checkbox mid-diff can't empty the box under you.
Tests
test/overlay.test.jsgains five cases in the existing jsdom harness (npm ci && npm test): the default filtered list, the toggle revealing everything and persisting the choice, the current prerelease staying visible while others don't, the all-unstable project, and the compare dropdown tracking the filter.All 8 frontend tests pass, including the three pre-existing compare/diff ones — worth noting because the compare dropdown's population had to be restructured into a re-runnable render function, and those tests cover the
/latest/path-math regression this area has produced before. Go suite green too.Docs
tutorials/uploading-docs.mdgains a "Which Versions Are Shown" section next to the existing version-sorting notes. Worth a Deploy Built-in Docs after merging.Trying it
Any project with a mix — one
v-tagged release plus a branch build — shows the difference immediately. A hard refresh may be needed to get past a cachedoverlay.js.Assisted by Claude Opus 5.