Fix giscus like not persisting by removing reaction-destroying remount - #505
Merged
soyalejolopez merged 7 commits intoJul 27, 2026
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
Gate remount recovery on whether the discussion has reactions instead of whether it exists. A resource whose Discussion already exists with 0 reactions (a #1312 ghost created by an earlier reverted first-reaction) now arms the remount so the first reaction sticks, matching the brand-new discussion path. Active discussions (reactionCount > 0) are left untouched. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 61593e5a-6c5f-46eb-bb43-08ee66fce301
Gate remount recovery on whether the discussion has reactions instead of whether it exists. A resource whose Discussion already exists with 0 reactions (a #1312 ghost created by an earlier reverted first-reaction) now arms the remount so the first reaction sticks, matching the brand-new discussion path. Active discussions (reactionCount > 0) are left untouched. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 61593e5a-6c5f-46eb-bb43-08ee66fce301
…lopez-fix-report-like-button
The per-resource giscus remount workaround for bug #1312 was itself destroying reactions. It remounted the iframe (container.innerHTML='') the instant a first reaction created the backing Discussion, at reactionCount 0, while the addReaction mutation was still in flight, aborting the commit before it landed. Every discussion created after the workaround shipped ended up with zero reactions; only a resource reacted to before it shipped kept its like. giscus persists reactions natively server-side, so remove the remount apparatus entirely: the emit-metadata listener, the blur speculative refetch, giscusClearPending, the data-emit-metadata attribute, and the isRefetch path. mountGiscus now just mounts. The residual #1312 in-session visual revert is cosmetic; the reaction is saved and correct on reload. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 61593e5a-6c5f-46eb-bb43-08ee66fce301
The per-resource giscus remount workaround for bug #1312 was itself destroying reactions. It remounted the iframe (container.innerHTML='') the instant a first reaction created the backing Discussion, at reactionCount 0, while the addReaction mutation was still in flight, aborting the commit before it landed. Every discussion created after the workaround shipped ended up with zero reactions; only a resource reacted to before it shipped kept its like. giscus persists reactions natively server-side, so remove the remount apparatus entirely: the emit-metadata listener, the blur speculative refetch, giscusClearPending, the data-emit-metadata attribute, and the isRefetch path. mountGiscus now just mounts. The residual #1312 in-session visual revert is cosmetic; the reaction is saved and correct on reload. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 61593e5a-6c5f-46eb-bb43-08ee66fce301
…lopez-fix-report-like-button
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.
The previous #1312 remount workaround was itself destroying reactions.
It remounted the giscus iframe (
container.innerHTML='') the instant a first reaction created the backing Discussion, at reactionCount 0, while the addReaction mutation was still in flight, aborting the commit before it landed. Server-side evidence confirmed it: every discussion created after the workaround shipped had zero reactions, and only a resource reacted to beforehand kept its like.giscus persists reactions natively server-side, so this PR removes the remount apparatus entirely: the emit-metadata listener, the blur speculative refetch,
giscusClearPending, thedata-emit-metadataattribute, and theisRefetchpath.mountGiscusnow just mounts (net -68 lines).The residual giscus #1312 quirk (the first reaction appears to flicker in-session) is cosmetic; the reaction is saved and shows correctly on reload.