Skip to content

Conversation

anettkva
Copy link
Member

Show the vault group number on the element page

Closes #125

For a vault, the element page showed the name of its element group under "Element group". For vaults that name is a long description (for example "Handspring, Yamashita, round-off with or without turn in 1st and/or 2nd flight phase"), not a short group name. The Elements list (#114) already shows "Group N" for a vault, so the element page now does the same, with the same rule.

Changes

  • src/lib/catalogOperations.ts: the catalogItem query also asks for elementGroup { id number }. The id lets Apollo's cache recognise the same group across queries, which removes this query's part of the "Cache data may be lost when replacing the elementGroup field" warning.
  • src/lib/catalog.ts: ElementDetail has elementGroupNumber, set by toElementDetail.
  • src/lib/elementList.ts: groupLabel accepts anything with isVault, elementGroupName and elementGroupNumber, so the list and the element page use the same function. The rule itself is unchanged.
  • src/components/elements/ElementMetadataCard.tsx: "Element group" shows groupLabel(element): "Group N" for a vault, and the name of the group for an element. (Prettier also reformatted two lines of the ElementValueBadge in this file.)
  • docs/AI_USAGE.md: a new entry for this issue.
Before After
Vault 1.00 Element group: Handspring, Yamashita, round-off with or without turn in 1st and/or 2nd flight phase Element group: Group 1
UB-1.101-a Element group: Mounts Element group: Mounts

Testing

  • New tests in ElementDetailPage.test.tsx: one for an element (shows the name of the group) and one for a vault (shows "Group 1" and not the description), with the real group of VT-1.22-a. Each fails on its own when the page shows the name for every item or "Group N" for every item.
  • catalog.test.ts checks that toElementDetail carries the number along.
  • tsc -b, ESLint, Prettier (on the changed files), npm run build and all 202 frontend tests pass.
  • Checked in a browser against the real backend: vault 1.00 shows "Group 1" in both the list and the element page, UB-1.101-a still shows "Mounts", and there is no Apollo warning in the console.

Not in this PR

  • The Elements list query (searchOperations.ts) still asks for elementGroup without id, so the cache warning can still appear from the list.

🤖 Generated with Claude Code

…ement page

- Ask for elementGroup.number (and id, so the cache recognises the group)
  in the catalogItem query
- Show "Group N" for a vault and the group name for an element, with the
  same groupLabel as the Elements list, so the two pages agree
- Test an element and a vault separately on the element page
- Add the issue to AI_USAGE.md

Closes #125

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anettkva anettkva requested a review from a team as a code owner October 30, 2026 19:57
Copy link
Member

@ronjalh ronjalh left a comment •

Choose a reason for hiding this comment

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

lgtm

@ronjalh ronjalh merged commit b889878 into dev Oct 30, 2026
@ronjalh ronjalh deleted the 125-show-the-vault-group-number-instead-of-the-description-on-the-element branch October 30, 2026 20:26
@ronjalh ronjalh mentioned this pull request Nov 3, 2026
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants