Skip to content

Fix giscus like not persisting by removing reaction-destroying remount - #505

Merged
soyalejolopez merged 7 commits into
microsoft:masterfrom
soyalejolopez:soyalejolopez-fix-report-like-button
Jul 27, 2026
Merged

Fix giscus like not persisting by removing reaction-destroying remount#505
soyalejolopez merged 7 commits into
microsoft:masterfrom
soyalejolopez:soyalejolopez-fix-report-like-button

Conversation

@soyalejolopez

Copy link
Copy Markdown
Member

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, the data-emit-metadata attribute, and the isRefetch path. mountGiscus now 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.

AnkitaDudeja and others added 7 commits July 23, 2026 16:34
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
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
@soyalejolopez
soyalejolopez merged commit af56292 into microsoft:master Jul 27, 2026
3 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.

2 participants