Skip to content

No table option#169

Merged
dlrice merged 7 commits into
mainfrom
no-table-option
May 14, 2026
Merged

No table option#169
dlrice merged 7 commits into
mainfrom
no-table-option

Conversation

@dlrice
Copy link
Copy Markdown
Contributor

@dlrice dlrice commented May 13, 2026

Purpose

Adapt <protvista-uniprot-structure> for an external React consumer to render its own data.

Approach

  • New properties on <protvista-uniprot-structure>:
    • no-table / noTable — the component no longer renders its internal <protvista-uniprot-datatable>, loader, or empty-state message.
    • selected-id / selectedId — reactive property that drives the viewer; defaults to the first row only if the consumer hasn't pre-set it.
    • structures-loaded event (CustomEvent<ReadonlyArray<ProcessedStructureData>>, bubbles + composed) — fires once after fetch resolution, with detail: [] when nothing was found.
  • ProcessedStructureData is now exported from the package root, with the rendered isoform: TemplateResult field replaced by raw isoformId / isoformIsCanonical (the <a> is built inside the column renderer).
  • Selection is centralised in a willUpdate hook: when selectedId or data changes the viewer either applies the matching row or clears its state, so stale selections don't linger.
  • protvista-uniprot-datatable is explicitly registered + default-exported so it survives tree-shaking when consumers only import the structure component.
  • IsoformIdSequence was typed as a single-element tuple, corrected to a real array.
  • Added the missing notooltip field declaration on ProtvistaUniprot (already in the reactive-properties bag).

Testing

  • Created new test file protvista-uniprot-structure-empty.spec.ts for the case of empty payloads

Visual changes

None, new behavior is opt-in via no-table.

Breaking changes

  • ProcessedStructureData.isoform (a TemplateResult) is removed in favour of isoformId: string + isoformIsCanonical: boolean. The type was not previously exported, so no external consumers are affected; internal callers of processAFData no longer need to pass accession.
  • The structures-loaded event now fires on empty results with detail: []. This is a new behavior, no prior contract to break

Checklist

  • My PR is scoped properly, and "does one thing only"
  • I have reviewed my own code
  • I have checked that linting checks pass and type safety is respected
  • I have checked that tests pass and coverage has at least improved, and if not explained the reasons why
  • If needed, the changes have been previewed by all interested parties.

@dlrice dlrice merged commit 0587aad into main May 14, 2026
6 checks passed
@dlrice dlrice deleted the no-table-option branch May 14, 2026 14:51
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.

2 participants