Skip to content

Commit 21f21ea

Browse files
jb55claude
andcommitted
fix: clear async load tracking when popping timeline routes
When navigating back from a profile (or any timeline route), the timeline was removed from the cache but its entry in loaded_timeline_loads was kept. This prevented the async loader from re-populating the timeline on subsequent visits, resulting in an empty note list. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1c3bec5 commit 21f21ea

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

crates/notedeck_columns/src/app.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ pub struct Damus {
5454
/// Background loader for initial timeline scans.
5555
timeline_loader: TimelineLoader,
5656
/// Timelines currently loading initial notes.
57-
inflight_timeline_loads: HashSet<TimelineKind>,
57+
pub inflight_timeline_loads: HashSet<TimelineKind>,
5858
/// Timelines that have completed their initial load.
59-
loaded_timeline_loads: HashSet<TimelineKind>,
59+
pub loaded_timeline_loads: HashSet<TimelineKind>,
6060

6161
//frame_history: crate::frame_history::FrameHistory,
6262

crates/notedeck_columns/src/nav.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ fn process_nav_resp(
285285
&mut app.view_state,
286286
ctx.ndb,
287287
&mut ctx.remote.scoped_subs(ctx.accounts),
288+
&mut app.loaded_timeline_loads,
289+
&mut app.inflight_timeline_loads,
288290
return_type,
289291
col,
290292
);

crates/notedeck_columns/src/route.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use notedeck::{
55
tr, Localization, NoteZapTargetOwned, ReplacementType, ReportTarget, RootNoteIdBuf, Router,
66
ScopedSubApi, WalletType,
77
};
8+
use std::collections::HashSet;
89
use std::ops::Range;
910

1011
use crate::{
@@ -803,6 +804,8 @@ pub fn cleanup_popped_route(
803804
view_state: &mut ViewState,
804805
ndb: &mut Ndb,
805806
scoped_subs: &mut ScopedSubApi,
807+
loaded_timeline_loads: &mut HashSet<TimelineKind>,
808+
inflight_timeline_loads: &mut HashSet<TimelineKind>,
806809
return_type: ReturnType,
807810
col_index: usize,
808811
) {
@@ -811,6 +814,10 @@ pub fn cleanup_popped_route(
811814
if let Err(err) = timeline_cache.pop(kind, ndb, scoped_subs) {
812815
tracing::error!("popping timeline had an error: {err} for {:?}", kind);
813816
}
817+
// Allow the async loader to re-populate this timeline if
818+
// it is opened again later.
819+
loaded_timeline_loads.remove(kind);
820+
inflight_timeline_loads.remove(kind);
814821
}
815822
Route::Thread(selection) => {
816823
threads.close(ndb, scoped_subs, selection, return_type, col_index);

crates/notedeck_columns/src/toolbar.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ fn pop_to_root(app: &mut Damus, ctx: &mut AppContext, col_index: usize) {
104104
&mut app.view_state,
105105
ctx.ndb,
106106
&mut ctx.remote.scoped_subs(ctx.accounts),
107+
&mut app.loaded_timeline_loads,
108+
&mut app.inflight_timeline_loads,
107109
ReturnType::Click,
108110
col_index,
109111
);

0 commit comments

Comments
 (0)