commit 194d244e3539008856c8e904c406910dbfcff551
parent eeb38115856e29d4b0eba9290123cbaaf767c41c
Author: William Casarin <jb55@jb55.com>
Date: Mon, 14 Nov 2022 18:14:10 -0800
web: don't redraw on duplicate timeline events
Diffstat:
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/web/index.html b/web/index.html
@@ -12,7 +12,7 @@
<script defer src="js/noble-secp256k1.js?v=1"></script>
<script defer src="js/bech32.js?v=1"></script>
<script defer src="js/nostr.js?v=6"></script>
- <script defer src="js/damus.js?v=79"></script>
+ <script defer src="js/damus.js?v=80"></script>
</head>
<body>
<script>
diff --git a/web/js/damus.js b/web/js/damus.js
@@ -356,23 +356,26 @@ function handle_home_event(ids, model, relay, sub_id, ev) {
ev = model.all_events[ev.id]
+ let is_new = true
switch (sub_id) {
case ids.explore:
const view = model.views.explore
if (should_add_to_explore_timeline(model.contacts, view, ev)) {
view.seen.add(ev.pubkey)
- insert_event_sorted(view.events, ev)
+ is_new = insert_event_sorted(view.events, ev)
}
- handle_redraw_logic(model, 'explore')
+ if (is_new)
+ handle_redraw_logic(model, 'explore')
break;
case ids.home:
if (should_add_to_timeline(ev))
- insert_event_sorted(model.views.home.events, ev)
+ is_new = insert_event_sorted(model.views.home.events, ev)
- handle_redraw_logic(model, 'home')
+ if (is_new)
+ handle_redraw_logic(model, 'home')
break;
case ids.account:
switch (ev.kind) {