# FIX: discourse-reactions rollback not working

**URL:** https://meta.discourse.org/t/fix-discourse-reactions-rollback-not-working/392855
**Category:** Bug
**Tags:** reactions
**Created:** [January 7, 2026, 7:24am UTC](https://meta.discourse.org/t/fix-discourse-reactions-rollback-not-working/392855 "2026-01-07T07:24:28Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![small-lovely-cat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/small-lovely-cat/32/553546_2.png) [@small-lovely-cat](https://meta.discourse.org/u/small-lovely-cat)
#### Post date: [January 7, 2026, 7:24am UTC](https://meta.discourse.org/t/fix-discourse-reactions-rollback-not-working/392855/1 "2026-01-07T07:24:28Z")

</div>

The discourse-reactions plugin has a rollback function, when the `toggle.json` request fails, the page should rollback the reactions to the original state.

However, the function is broken, and the original `_rollbackState()` function never works as the state itself changes when `toggleReaction` is called. And the reaction state never goes back without refreshing/reloading the window, leading to the heart/reactions leaving on the page even when the request failed.

This commit fixs this by adding a new function `_captureState()`, keeping the state in a const value, and revert it to the page data when necessary.

[https://github.com/discourse/discourse/pull/36989](https://github.com/discourse/discourse/pull/36989)

---

_[View the full topic](https://meta.discourse.org/t/fix-discourse-reactions-rollback-not-working/392855)._
