Skip to content

fix(filters): multi-select license/modality (form repeated params) (#98) - #100

Merged
neuromechanist merged 2 commits into
mainfrom
feature/issue-98-multiselect-params
Jun 3, 2026
Merged

neuromechanist merged 2 commits into
mainfrom
feature/issue-98-multiselect-params

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Fixes #98.

Problem

Selecting two license chips (e.g. Share-alike + Non-commercial) applied only the first — "resets to share-alike". Same flaw on multi-modality.

Root cause

The sidebar is a native GET form, so a checkbox group named license submits repeated params (?license=a&license=b), but filterStateFromURL read only the first via params.get(). (Our own pagination/tag links comma-join, which is why those worked.)

Fix

Parse license/modality with params.getAll() and split each element on comma, so the repeated (form) and comma-joined (link) encodings parse identically. Chips stay real multi-select toggles — no UI change needed. The server already does OR.

Verified live

  • ?license=sharealike&license=noncommercial → "24 datasets", both chips selected (was "16", only share-alike)
  • ?modality=EEG&modality=MEG → both modality chips selected
  • comma-joined URLs (pagination, tag links) still work

Tests

typecheck 0 errors · biome clean · 478 unit tests pass (added repeated-param coverage for both license and modality) · build clean.

The sidebar is a native GET form, so a checkbox group submits repeated
params (?license=a&license=b), but filterStateFromURL read only the first
via params.get() — selecting two tiers collapsed to one ('resets to
share-alike'). Same flaw hit multi-modality.

Parse with params.getAll() and split each element on comma, so both the
repeated (form) and comma-joined (our links) encodings parse identically.
Keeps the chips as real multi-select toggles; no UI change.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 3, 2026 •

Copy link
Copy Markdown

Deploying nemar-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 72dc2ee
Status:⚡️  Build in progress...

View logs

Mirror parseModalities' empty-part guard in parseLicenseTiers and cover
the ?license=&license=public mixed-empty case.
@neuromechanist

Copy link
Copy Markdown
Contributor Author

PR review addressed

Reviewed with the code-reviewer agent (Sonnet) — no critical/important issues; core fix confirmed correct (getAll + comma-split, dedup across encodings, iEEG casing, round-trip with comma-joined links, helpers are file-private). Applied the two cheap suggestions:

  • Explicit empty-tier guard in parseLicenseTiers to mirror parseModalities.
  • Added the ?license=&license=public mixed-empty edge-case test.

The third note (format uses params.get()) is a genuine non-issue — format isn't exposed as a multi-value control, so it's single-value by design.

Validation: typecheck 0 errors, biome clean, 479 tests pass, build clean.

@neuromechanist
neuromechanist merged commit 8e8af21 into main Jun 3, 2026
1 check was pending
@neuromechanist
neuromechanist deleted the feature/issue-98-multiselect-params branch June 3, 2026 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-select license/modality drops all but the first (form repeated params)

1 participant