Show own reactions from other devices live; fix mis-styling of others' reactions#68
Conversation
533cd88 to
58f2075
Compare
|
Nice fix — the idempotency-per- The Consequences:
Initial-load styling is fine (computed from Suggested fix: route the reducer through the setter ( Minor follow-up: the length-based dedup assumes |
…tUserID (wires panes) + decrement truncated-list reaction removals
|
Good catch on both — fixed in 9044917. Blocking (HasReacted in production): routed both reducer spots through the setter — Minor (truncated reactor lists): made the dedup guard truncation-aware instead of unconditional. The skip now only applies when the user is absent from the list and |
|
🍨 |
Closes #67.
Problem
A reaction you add from another device (Slack web/mobile) didn't appear live in slk on the channel you were viewing — it only showed after switching channels and back. The WS
reaction_addedevent arrived fine (verified viaSLK_DEBUG); the live UI update was being dropped.Root cause
reduceReactionsfiltered out every reaction by your own account (if m.UserID != a.currentUserID) to avoid double-counting the WS echo of your own optimistic update. But that also discarded reactions you made elsewhere, which had no optimistic update in slk — so they never rendered until a cache reload. The underlying reason a filter was needed at all:UpdateReactionincrementedCounteven when the userID was already present.A related secondary bug:
UpdateReactionsetHasReacted = truefor any reactor, so another user's reaction (which already showed live) was mis-styled as your own.Fix
reaction_added/reaction_removedevent.UpdateReactionidempotent per(emoji, userID)—Countchanges only on real membership change — so an optimistic update and its WS echo collapse to one count. This is what makes dropping the self-filter safe.HasReactedonly for the current user via a newSetCurrentUseron the message and thread panes, fixing the mis-styling of other users' reactions.Testing
go test ./...passes; addedTestUpdateReactionIdempotentAndHasReactedcovering double-apply (optimistic + echo → count 1), other-user merge, andHasReactedcorrectness.