Skip to content

Isolate singleplayer tossup card collapse state for repeated question IDs - #571

Merged
geoffrey-wu merged 4 commits into
mainfrom
copilot/qbreader-website-562-fix-tossup-collapse
Sep 4, 2026
Merged

Isolate singleplayer tossup card collapse state for repeated question IDs#571
geoffrey-wu merged 4 commits into
mainfrom
copilot/qbreader-website-562-fix-tossup-collapse

Conversation

Copilot AI commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

In singleplayer tossup history, repeated appearances of the same tossup reused identical DOM IDs (question-${_id}), so collapsing one card toggled every matching card. This change scopes collapse/report/star elements to each rendered card instance while preserving the canonical tossup ID for backend actions.

  • Singleplayer tossup card ID isolation

    • Updated /client/play/tossups/add-tossup-game-card.js to generate a per-render uniqueId.
    • Derived card-local element IDs from that value (questionId, reportQuestionId, starTossupId) instead of raw _id.
    • Pointed collapse targets and event bindings at those card-local IDs.
  • Behavioral impact

    • Collapse/expand now applies only to the clicked card, even when the same tossup appears multiple times in history.
    • Reporting and starring continue to submit/use the original tossup _id.
const uniqueId = `${_id}-${Date.now()}-${Math.random().toString(36).slice(2)}`;
const questionId = `question-${uniqueId}`;

data-bs-target="#${questionId}"
id="${questionId}"

Copilot AI linked an issue Aug 31, 2026 that may be closed by this pull request
Co-authored-by: geoffrey-wu <42471355+geoffrey-wu@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix tossup collapsing for singular tossups in singleplayer Isolate singleplayer tossup card collapse state for repeated question IDs Aug 31, 2026
Copilot AI requested a review from geoffrey-wu August 31, 2026 01:57
@geoffrey-wu
geoffrey-wu marked this pull request as ready for review September 4, 2026 02:26
@geoffrey-wu
geoffrey-wu merged commit c61bdfd into main Sep 4, 2026
2 checks passed
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.

From Discord: (see description)

2 participants