Hide prereleases and branch builds in the version picker (fixes #128) #142

Merged
qwc merged 1 commit from feature/hide-prereleases into main 2026-08-30 20:07:09 +02:00
Owner

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

introduce a checkbox in the top bar for all releases, and hide automatically any prereleases, rc or branches

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 v1.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 matches v1.2.3-rc1 too — 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

  • The version being read is always listed, even when it's a prerelease. Otherwise opening /project/x/v2.0.0-rc1/ would leave the picker unable to show the page you're on.
  • A project whose versions are all unstable lists everything and hides the checkbox. Filtering there would leave a picker with a single entry. This one came out of the test suite rather than my own foresight: I'd hidden the checkbox but left the filter active, so the branch-only project showed just 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.js gains 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.md gains 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 cached overlay.js.


Assisted by Claude Opus 5.

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 > introduce a checkbox in the top bar for all releases, and hide automatically any prereleases, rc or branches 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 matches `v1.2.3-rc1` too — 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 - **The version being read is always listed**, even when it's a prerelease. Otherwise opening `/project/x/v2.0.0-rc1/` would leave the picker unable to show the page you're on. - **A project whose versions are all unstable lists everything and hides the checkbox.** Filtering there would leave a picker with a single entry. This one came out of the test suite rather than my own foresight: I'd hidden the checkbox but left the filter active, so the branch-only project showed just `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.js` gains 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.md` gains 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 cached `overlay.js`. --- Assisted by Claude Opus 5.
Hide prereleases and branch builds in the version picker (fixes #128)
All checks were successful
CI / test (pull_request) Successful in 1m20s
CI / build (pull_request) Successful in 48s
CI / docker (pull_request) Has been skipped
29b04ceb87
A project that publishes a build per branch or per release candidate
ends up with a version dropdown where the actual releases are hard to
find. The picker now lists stable releases by default — digits and dots
after an optional "v" — and an "All" checkbox in the top bar reveals
release candidates, prereleases and branch builds. The choice is
remembered in localStorage as the reader moves between pages.

Two cases keep the filter from hiding what matters: the version being
read is always listed even when it is a prerelease, otherwise the
picker could not show the current page; and a project whose versions
are all unstable lists everything and hides the checkbox, since
filtering there would leave a picker with one entry.

The compare dropdown follows the same filter, keeping whatever version
is selected visible so toggling mid-diff does not empty the box.

Assisted-by: Claude Opus 5

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Marcel M. Otte <marcel.otte@mmo.to>
qwc merged commit 3976836cc3 into main 2026-08-30 20:07:09 +02:00
qwc deleted branch feature/hide-prereleases 2026-08-30 20:07:10 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
qwc-open/asiakirjat!142
No description provided.