Skip to content

Fix legend visibility persistence, CATH-Gene3D splitting, and Feedback button styling#284

Merged
tsenoner merged 7 commits into
mainfrom
fix/legend-persistence-cath-split-feedback-button
Jun 17, 2026
Merged

Fix legend visibility persistence, CATH-Gene3D splitting, and Feedback button styling#284
tsenoner merged 7 commits into
mainfrom
fix/legend-persistence-cath-split-feedback-button

Conversation

@tsenoner

@tsenoner tsenoner commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Three independent bug fixes plus follow-up cleanup.

Cleanup (no behaviour change) — rewrote the top-level ; splitter as an index + slice scan (no per-char allocation or code-point decoding; output identical, splitter tests unchanged) and documented its net-imbalance fallback limitation; removed the dead app-side legend hiddenValues / handleLegendItemClick now that the core legend owns hidden state.

Backend follow-ups (separate repo): tsenoner/protspace#56 (; at source), tsenoner/protspace#58 (| at source).

Closes #281, #282, #283

tsenoner and others added 5 commits June 17, 2026 14:41
Switching annotations called clearPersistedLegendHiddenValues, which
rewrote the previous annotation's legend localStorage entry to an empty
hiddenValues array, so hidden categories reappeared on switch-back. The
core legend already persists and restores hiddenValues per datasetHash +
annotation, so remove the clearing call and its now-dead plumbing
(the persisted-legend controller, its runtime wiring, and the
lastKnownAnnotation tracking it required).

The demo still resets on a full reload via the separate
clearForNewDataset path, so it always returns to its original state.

Closes #281

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Categorical annotation cells encode multiple hits as
"accession (name)|score" joined by ';', but a name can itself contain
';' (e.g. CATH-Gene3D "Ribosomal Protein L15; Chain: K; domain 2"). The
naive split(';') shattered a single hit into bogus categories such as
"domain 2)" and "Chain: K". Split only on ';' at parenthesis depth 0 so
each (name) stays intact, falling back to a plain split for the rare
name with an unbalanced '(' so distinct hits are not merged.

This repairs already-distributed bundles; sanitizing the names at the
source is tracked in tsenoner/protspace#56.

Closes #282

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Feedback button rendered with the shadcn default variant (solid
bg-primary #3c83f6), a different and more prominent blue than the
canonical ProtSpace #00a3e0 used in-canvas. Switch both the desktop and
mobile call sites to a no-border ghost: transparent, #00a3e0 text/icon,
faint blue hover. De-emphasized and consistent on the light and dark
headers.

Closes #283

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The top-level ; splitter only needs its per-char paren-depth scan when a
cell contains a parenthesis. Most categorical columns (Kingdom/Organism/
Localization) never do, so short-circuit to a native split for them —
behavior-identical since depth stays 0 throughout.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The canonical brand blue #00a3e0 only reaches ~2.6:1 against the light
Explore header (#f4f4f4), failing WCAG AA (4.5:1). Make the ghost CTA
hue variant-aware: keep #00a3e0 on the dark header (~5.6:1) and use a
darker #006d96 (~5.3:1) on the light variant. Both hues are literal
class strings so Tailwinds source scan can generate them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tsenoner tsenoner force-pushed the fix/legend-persistence-cath-split-feedback-button branch from 230df7c to 21c9a75 Compare June 17, 2026 19:38
tsenoner and others added 2 commits June 17, 2026 22:42
Replace the per-character `for..of` + `current += ch` build in
splitOnTopLevelSemicolons with an index + slice scan: no per-char
allocation, no code-point decoding, byte-identical output (25 splitter
tests unchanged).

Also document the fallback's net-imbalance limitation — a stray '(' in
one hit cancelled by a stray ')' in a later hit leaves end-depth 0, so
the inter-hit ';' is swallowed and the two hits merge (subsumed by the
name-sanitization work in tsenoner/protspace#56) — and add a JSDoc block
to the now-exported splitCategoricalAnnotationValues.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The core legend owns per-annotation hidden categories
(saveSettings/loadSettings + syncHiddenValues, keyed by datasetHash +
annotation). The interaction controller's `hiddenValues` field and
`handleLegendItemClick` only mutated write-only state that was never
pushed to the plot, and `handleAnnotationChange` always pushed `[]`
regardless of click history.

Remove the field, the handler, and its now-dead `legend-item-click`
listener; push `[]` directly and document why the core's async restore
runs after this synchronous reset. Behaviour-identical — the legend
hide/restore e2e tests still pass on Chromium, Firefox and WebKit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tsenoner tsenoner merged commit c7f73cd into main Jun 17, 2026
4 checks passed
@tsenoner tsenoner deleted the fix/legend-persistence-cath-split-feedback-button branch June 17, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Legend category visibility not persisted when switching annotations

1 participant