fix(reactions): self-heal the Recent emoji row after a react (LC-390) #402
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/lc-390-recent-emoji-refresh"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes LC-390. The reaction picker's "Recent" row did not reflect a just-used emoji until a full page reload.
Root cause
The Recent row is rendered empty by the server and filled entirely client-side from
localStorage['lc-recent-emoji']by the LC-288 IIFE inlayout.html.fill()was a one-shot, open-time snapshot: it setdata-lc-recent-doneon first scan and read localStorage at that instant, then never refilled for the life of that picker instance. So any react performed after the row was filled stayed invisible until a reload re-ran the fill from scratch. (Confirmed not a service-worker issue:sw.jsdoes not cache the picker fragment, so the row was always built from fresh markup; the staleness was purely in the one-shot fill.)Fix
render()rebuilds the row from the current MRU on every scan, skipping only when this box's rendered set is unchanged (signature = the joined glyph list). The scan firing on unrelatedafterSettleevents (WS / sidebar swaps) is therefore a cheap no-op and never duplicates buttons, while a changed MRU always refills. The scan selector drops the:not([data-lc-recent-done])gate.record()now callsscan()after writing localStorage, so an already-open picker updates the instant you react (no reopen, no reload).storagelistener refreshes the row when another tab reacts or clears the MRU.canon()appends VS-16 to the known bare emoji-presentation code points on both record and read (so legacy entries dedupe onto the qualified form), and the quick-bar heart default is now fully qualified. Recent now matches the grid and dedupes correctly.Client-only change in
server/templates/layout.html; the server still renders the Recent row empty (no Rust change).Testing
./dev/cargo checkclean (Askama template compiles).just testandjust test-saasboth green (exit 0, zero failures). No server contract changed; the fix is in the picker's client JS, which the integration tests don't exercise, so the validation is the compile + the manual repro below.No operator-visible change (UI only): no
[operator-action]marker.