Fix giscus like button not persisting on first reaction#498
Merged
soyalejolopez merged 1 commit intoJul 23, 2026
Merged
Conversation
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
Contributor
🛰️ PR Sweeper reportRisk: 🟢 LOW · Security gate: ✅ passing · Files: 1 🔒 Automated guardrails (authoritative)
🤖 Dual-model AI review (advisory)Deep-reasoning reviewer —
|
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.
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
existedAtMountvia the giscus emit-metadata listener and force a single refetch remount once a discussion is created by a first reaction.hasDiscussionre-check from the blur-timer callback that was cancelling the very remount meant to persist the like.speculativeRefetchflag + re-arm branch so focusing the iframe without reacting (e.g. to sign in) doesn't permanently block recovery.Validation
Ref: giscus/giscus#1312