web: more caching fixes
This commit is contained in:
parent
add261dd01
commit
d9d293901b
2 changed files with 10 additions and 5 deletions
|
@ -57,14 +57,16 @@ async function damus_web_init_ready() {
|
|||
if (err) {
|
||||
window.alert("Unable to load contacts.");
|
||||
}
|
||||
|
||||
await model_load_events(model, (ev)=> {
|
||||
model_process_event(model, ev);
|
||||
});
|
||||
|
||||
log_debug("loaded events", Object.keys(model.all_events).length);
|
||||
view_timeline_update(model);
|
||||
view_timeline_apply_mode(model, VM_FRIENDS);
|
||||
view_show_spinner(true);
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
update_title(model)
|
||||
update_title(model);
|
||||
});
|
||||
on_timer_timestamps();
|
||||
on_timer_invalidations();
|
||||
|
@ -127,6 +129,7 @@ async function on_pool_eose(relay, sub_id) {
|
|||
if (!model.inited) {
|
||||
model.inited = true;
|
||||
}
|
||||
view_show_spinner(false);
|
||||
break;
|
||||
case ids.profiles:
|
||||
model.pool.unsubscribe(ids.profiles, relay);
|
||||
|
|
|
@ -60,7 +60,6 @@ function view_timeline_apply_mode(model, mode, opts={}) {
|
|||
count++;
|
||||
}
|
||||
if (count > 0) {
|
||||
find_node("#view .loading-events").classList.add("hide");
|
||||
el.append(fragment);
|
||||
view_set_show_count(0);
|
||||
view_timeline_update_timestamps();
|
||||
|
@ -69,6 +68,10 @@ function view_timeline_apply_mode(model, mode, opts={}) {
|
|||
return mode;
|
||||
}
|
||||
|
||||
function view_show_spinner(show=true) {
|
||||
find_node("#view .loading-events").classList.toggle("hide", !show);
|
||||
}
|
||||
|
||||
/* view_timeline_update iterates through invalidated event ids and either adds
|
||||
* or removes them from the timeline.
|
||||
*/
|
||||
|
@ -114,7 +117,7 @@ function view_timeline_update(model) {
|
|||
// If we have things to show and we have initted and we don't have
|
||||
// anything update the current view
|
||||
if (!latest_ev && model.inited) {
|
||||
view_timeline_show_new(model);
|
||||
view_timeline_show_new(model);
|
||||
}
|
||||
view_set_show_count(count, true, !model.inited);
|
||||
}
|
||||
|
@ -156,7 +159,6 @@ function view_timeline_show_new(model) {
|
|||
count++;
|
||||
}
|
||||
if (count > 0) {
|
||||
find_node("#view .loading-events").classList.add("hide");
|
||||
el.prepend(fragment);
|
||||
}
|
||||
view_set_show_count(-count, true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue