damus.io

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

commit ff1d5cb609a56362de908d04b8816529d09107a4
parent db97ee909b0ac333370f6aa0f26da3d3d140829d
Author: William Casarin <jb55@jb55.com>
Date:   Sun, 20 Nov 2022 20:44:44 -0800

reduce redraw amounts

Diffstat:
Mweb/js/damus.js | 21++++++++++-----------
Mweb/js/ui/render.js | 1+
2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/web/js/damus.js b/web/js/damus.js @@ -573,12 +573,10 @@ function get_current_view() function handle_redraw_logic(model, view_name) { - if (get_current_view().name === view_name) { - const view = model.views[view_name] - if (view.redraw_timer) - clearTimeout(view.redraw_timer) - view.redraw_timer = setTimeout(redraw_events.bind(null, model, view), 500) - } + const view = model.views[view_name] + if (view.redraw_timer) + clearTimeout(view.redraw_timer) + view.redraw_timer = setTimeout(redraw_events.bind(null, model, view), 600) } function schedule_save_events(damus) @@ -927,7 +925,7 @@ function switch_view(name, opts={}) // TODO accomodate views that do not render events // TODO find out if having multiple event divs is slow - redraw_timeline_events(DAMUS, name) + //redraw_timeline_events(DAMUS, name) find_node("#nav > div[data-active]").dataset.active = name; @@ -971,20 +969,21 @@ function load_our_contacts(contacts, our_pubkey, ev) { function handle_profiles_loaded(ids, model, view, relay) { // stop asking for profiles model.pool.unsubscribe(ids.profiles, relay) - redraw_events(model, view) - redraw_my_pfp(model) + + //redraw_events(model, view) + //redraw_my_pfp(model) const prefix = difficulty_to_prefix(model.pow) const fofs = Array.from(model.contacts.friend_of_friends) const standard_kinds = [1,42,5,6,7] - let pow_filter = {kinds: standard_kinds, limit: 200} + let pow_filter = {kinds: standard_kinds, limit: 50} if (model.pow > 0) pow_filter.ids = [ prefix ] let explore_filters = [ pow_filter ] if (fofs.length > 0) { - explore_filters.push({kinds: standard_kinds, authors: fofs, limit: 200}) + explore_filters.push({kinds: standard_kinds, authors: fofs, limit: 50}) } model.pool.subscribe(ids.explore, explore_filters, relay) diff --git a/web/js/ui/render.js b/web/js/ui/render.js @@ -14,6 +14,7 @@ function render_timeline_event(damus, view, ev) } function render_events(damus, view) { + log_debug("rendering events") return view.events .filter((ev, i) => i < 140) .map((ev) => render_timeline_event(damus, view, ev)).join("\n")