damus.io

damus.io website
git clone git://jb55.com/damus.io
Log | Files | Refs | README

commit 572122b581e133007cda747426ec12d64230e10f
parent 206a658249a03f0e1a0ac132d874d1f98f243f4e
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 11 Nov 2022 13:12:44 -0800

web: ignore all duplicate events

Diffstat:
Mweb/damus.js | 13++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/web/damus.js b/web/damus.js @@ -294,6 +294,10 @@ function should_add_to_home(ev) let rerender_home_timer function handle_home_event(ids, model, relay, sub_id, ev) { + // ignore duplicates + if (model.all_events[ev.id]) + return + model.all_events[ev.id] = ev process_event(model, ev) @@ -324,13 +328,8 @@ function handle_home_event(ids, model, relay, sub_id, ev) { function process_profile_event(model, ev) { const prev_ev = model.profile_events[ev.pubkey] - if (prev_ev) { - if (ev.id === prev_ev.id) - return - - if (prev_ev.created_at > ev.created_at) - return - } + if (prev_ev && prev_ev.created_at > ev.created_at) + return model.profile_events[ev.pubkey] = ev try {