What's That: render one representative tile per illustration group - #730
Merged
Conversation
The vote path (selectIllustrationGroup) already submits a single illustrationId for the whole cluster, so the render side rendering every member of the cluster showed the same artwork up to 9 times for a question with one answer. Render only a representative tile per group instead: prefer a member with an art crop (the same signal a tile's own image already prefers), falling back to the group's first member when none has one, so the pick is stable across renders of the same data. The submitted illustrationId is unchanged - every group member shares it.
…resentative-tile render Three Level 2 illustration-grouping specs still asserted the retired one-tile-per-group-member render: they expected candidateB (which shares an illustration with candidateA but has no art crop) to get its own DOM tile, both inside the group container and in the top-level candidate list. The group now renders exactly one representative tile per cluster (group.find((c) => c.artCropUrl) ?? group[0]), so a non-representative member renders no tile of its own anywhere - it's represented through the group's shared illustration vote, not silently dropped. Renamed and rewrote the three affected titles to assert the new contract directly (representative renders, non-representative member renders nowhere, ungrouped candidates are unaffected) and added the matching coverage-ack entries for the renames.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a What's That Card question is about which illustration a card uses, the grouped-tile render (
illustrationGroups.mapinQuestionFeed.tsx) rendered every candidate in the cluster as its own tile, while the tap handler (selectIllustrationGroup) already submits a singleillustrationIdfor the whole group regardless of which member was tapped. A 4-printing group showed 4 near-identical images for a question with one answer; production data has groups as large as 9.This renders exactly one representative tile per illustration group. The representative is chosen deterministically: the first group member with an
artCropUrlset, falling back to the group's first member when none has one. This reuses a signal the render already applies per-tile (a tile's own image already prefersartCropUrlover the full scan), rather than inventing a new one, and the same input data always picks the same tile.The submitted vote is unchanged:
selectIllustrationGroupstill receives the group's sharedillustrationId(every member carries the same one), now sourced from the representative candidate instead of whichever member was tapped — the network payload is byte-for-byte identical to before. The group's own membership count (Same illustration - N printings) anddata-illustration-idattribute are both untouched, so the cluster is still discoverable.Separately, this investigated the issue's second symptom ("the first row of illustrations is hidden"). Live-browser reproduction (Playwright against the running app with a mock backend) showed the illustration group rendering clearly and visibly immediately below the "Filter by attribute" toggle, with its label, printing count, artist credit, and representative tile all present — it did not reproduce. No suppression, filter, or hiding logic exists in the render path, consistent with the prior static-code finding; this change does not touch anything that would affect visibility, and the symptom did not appear in this reproduction attempt.
Test plan
jest src/features/questionFeed/QuestionFeed.test.tsx— all 21 tests pass, including 2 new tests covering the art-crop-preferred representative pick (regardless of the crop's position in the group) and the fallback to the group's first member when no member has a croptsc --noEmiton the changed file — no new type errors (two pre-existing, unrelated errors from a missing generated asset and a dev-only module are present onmastertoo){ illustrationId: <shared id> }to/2/submitIllustrationVote/— identical to the pre-existing vote contract