Skip to content

feat(components): add per-mutation name/description overrides to MutationAnnotation#1121

Merged
fhennig merged 3 commits into
mainfrom
feat/mutation-annotation-per-mutation-overrides
Jun 9, 2026
Merged

feat(components): add per-mutation name/description overrides to MutationAnnotation#1121
fhennig merged 3 commits into
mainfrom
feat/mutation-annotation-per-mutation-overrides

Conversation

@fhennig

@fhennig fhennig commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Closes #1120

Summary

  • Entries in nucleotideMutations, aminoAcidMutations, nucleotidePositions, and aminoAcidPositions can now be a plain string or an object with optional name/description fields that override the group-level annotation values in the popup
  • Overrides are resolved eagerly at index-build time in buildAnnotationIndex, so no extra work happens at render time
  • Plain string arrays remain valid — fully backward compatible at runtime

Example

{
  "name": "3CLpro inhibitor resistance",
  "description": "Mutations affecting 3CLpro drug binding",
  "symbol": "c",
  "nucleotideMutations": [
    { "mutation": "ORF1a:T2343C", "name": "3CLpro:T31C", "description": "Disrupts nirmatrelvir binding" },
    "ORF1a:G2558A"
  ]
}

Annotation type change

The TypeScript types for the four list fields change from string[] to (string | { mutation/position: string; name?: string; description?: string })[]. Consumers passing plain string arrays are unaffected at runtime; only strict TypeScript type checks would surface a difference.

Test plan

  • All 211 existing tests pass
  • New MutationWithPerMutationInfoOverride story covers the override path

🤖 Generated with Claude Code

@vercel

vercel Bot commented Jun 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dashboard-components Ready Ready Preview, Comment Jun 8, 2026 1:56pm

Request Review

…tionAnnotation

Entries in nucleotideMutations, aminoAcidMutations, nucleotidePositions, and
aminoAcidPositions can now be either a plain string or an object with an optional
name and description that override the group-level values in the annotation popup.

BREAKING CHANGE: The four mutation/position list fields on MutationAnnotation now
accept (string | { mutation: string; name?: string; description?: string })[] and
(string | { position: string; name?: string; description?: string })[] respectively,
instead of string[]. Existing plain-string arrays remain valid.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for per-mutation (and per-position) name/description overrides in mutation annotations, resolving those overrides eagerly when building the annotation lookup index so UI rendering remains simple and backward compatible with existing string-only configs.

Changes:

  • Extend the mutation annotation schema/types to allow list entries to be either strings or { mutation/position, name?, description? } objects.
  • Build a resolved annotation index (ResolvedMutationAnnotation) at provider setup time and update consumers to render resolved names/descriptions.
  • Add story + unit tests covering the override behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
components/src/web-components/mutationAnnotations.mdx Documents the new per-entry override shape and provides an example.
components/src/web-components/mutation-annotations-context.ts Updates Zod schema/types to accept per-entry override objects.
components/src/web-components/gs-app.ts Updates public prop typings and JSDoc to reflect new entry shapes.
components/src/preact/MutationAnnotationsContext.tsx Builds an indexed lookup with resolved per-entry name/description overrides.
components/src/preact/MutationAnnotationsContext.spec.tsx Updates expectations for resolved outputs and adds override-focused tests.
components/src/preact/components/annotated-mutation.tsx Renders resolved title/description in the annotation modal.
components/src/preact/components/annotated-mutation.stories.tsx Adds a story to demonstrate per-mutation override display.
components/src/preact/mutationsOverTime/getFilteredMutationCodes.ts Adapts filtering to the new resolved annotation shape.
components/src/preact/mutationsOverTime/getFilteredMutationCodes.spec.ts Updates tests to build the new annotation index before filtering.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread components/src/preact/mutationsOverTime/getFilteredMutationCodes.ts
Comment thread components/src/web-components/mutationAnnotations.mdx Outdated
@fengelniederhammer

Copy link
Copy Markdown
Collaborator

Breaking change

The TypeScript types for the four list fields change from string[] to (string | { mutation/position: string; name?: string; description?: string })[]. Consumers passing plain string arrays are unaffected at runtime; only strict TypeScript type checks would surface a difference.

This isn't really breaking, is it?

@fengelniederhammer fengelniederhammer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • what Copilot said

Comment thread components/src/preact/MutationAnnotationsContext.tsx Outdated
…-mutation overrides

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread components/src/preact/components/annotated-mutation.tsx
Comment on lines +51 to +67
<gs-app
lapis="https://your.lapis.url"
mutationAnnotations="[
{
name: '3CLpro inhibitor resistance',
description: 'Mutations affecting 3CLpro drug binding.',
symbol: 'c',
nucleotideMutations: [
{ mutation: 'ORF1a:T2343C', name: '3CLpro:T31C', description: 'Disrupts nirmatrelvir binding.' },
{ mutation: 'ORF1a:G2558A', name: '3CLpro:E166K' },
'ORF1a:C2566T'
]
},
]"
>
{/* children... */}
</gs-app>
@fhennig fhennig merged commit bccd701 into main Jun 9, 2026
8 of 10 checks passed
@fhennig fhennig deleted the feat/mutation-annotation-per-mutation-overrides branch June 9, 2026 16:42
fhennig added a commit that referenced this pull request Jun 10, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.18.0](dashboard-components-v1.17.0...dashboard-components-v1.18.0)
(2026-06-09)


### Features

* **components:** add per-mutation name/description overrides to
MutationAnnotation
([#1121](#1121))
([bccd701](bccd701))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Felix Hennig <mail@felixhennig.com>
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.

MutationAnnotation: add optional per-mutation name/description overrides

3 participants