Skip to content

Fix giscus like button not persisting on first reaction#498

Merged
soyalejolopez merged 1 commit into
microsoft:masterfrom
soyalejolopez:soyalejolopez-fix-report-like-button
Jul 23, 2026
Merged

Fix giscus like button not persisting on first reaction#498
soyalejolopez merged 1 commit into
microsoft:masterfrom
soyalejolopez:soyalejolopez-fix-report-like-button

Conversation

@soyalejolopez

Copy link
Copy Markdown
Member

Problem

Clicking "like" (giscus reaction) on a resource that has no backing Discussion yet makes the 👍 vanish instead of sticking. This is giscus bug ##1312: the first reaction creates the discussion + reaction server-side, but the giscus client never refetches, so the reaction visually reverts.

Fix

  • Event-driven remount: track existedAtMount via the giscus emit-metadata listener and force a single refetch remount once a discussion is created by a first reaction.
  • Removed the self-defeating hasDiscussion re-check from the blur-timer callback that was cancelling the very remount meant to persist the like.
  • Added a speculativeRefetch flag + re-arm branch so focusing the iframe without reacting (e.g. to sign in) doesn't permanently block recovery.

Validation

  • Local Playwright load: zero console errors, giscus mounts, detail view renders.
  • Peer-reviewed by GPT 5.6 (caught an edge case, re-reviewed PASS).

Ref: giscus/giscus#1312

The report detail page embeds giscus for likes. On resources with no backing Discussion yet, the first reaction hit giscus bug #1312: giscus creates the discussion and adds the reaction server-side but never refetches, so the like visually reverts until a manual refresh.

Fix the existing workaround so the remount reliably fires:

- Event-driven remount: track whether a discussion existed at mount time and remount once when metadata reports it was just created by the user's reaction.

- Remove the self-defeating hasDiscussion re-check from the blur-timer callback (it cancelled the very remount meant to persist the like).

- Re-arm recovery when a speculative (blur-triggered) refetch finds no discussion, so a later genuine first reaction can still stick.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 61593e5a-6c5f-46eb-bb43-08ee66fce301
@soyalejolopez
soyalejolopez merged commit a577677 into microsoft:master Jul 23, 2026
1 check passed
@github-actions

Copy link
Copy Markdown
Contributor

🛰️ PR Sweeper report

Risk: 🟢 LOW · Security gate: ✅ passing · Files: 1

🔒 Automated guardrails (authoritative)

Category Location Finding
ℹ️ scope Change(s) outside known content roots: index.html.

🤖 Dual-model AI review (advisory)

Deep-reasoning revieweropenai/o3 · verdict: approve · risk: low

PR adjusts giscus discussion-recovery logic, adds two state flags and slightly increases the blur fallback timeout. No secrets, dangerous calls, or privacy exposures detected. Change is self-contained and aligns with existing style.

Quality notes:

  • index.html — Clear inline comments improve code readability; uses non-minified JS with no new external dependencies. No repo metadata changes needed for this small bug-fix style update.

✅ Suggested next steps

  • Consider adding a short comment in the commit message or PR description explaining the rationale for the 3 s timeout to help future maintainers.
  • If automated tests exist for comment-thread behavior, add a test case covering speculative refetch re-arming.

The automated guardrails are authoritative and gate the security status. The AI review is advisory and never auto-merges. Thanks for contributing to FastTrack! 🛩️

@github-actions github-actions Bot added sweeper:ai-reviewed PR Sweeper: dual-model AI review attached sweeper:risk-low PR Sweeper: low risk sweeper:scope-review PR Sweeper: scope/sensitive-path review labels Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sweeper:ai-reviewed PR Sweeper: dual-model AI review attached sweeper:risk-low PR Sweeper: low risk sweeper:scope-review PR Sweeper: scope/sensitive-path review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants