threads: check for new notes locally when thread is re-opened
We have a NoteRef cache for threads in memory, which is just a list of NoteKeys and timestamps. When reopening a thread, query the local DB to see if there are any new notes that we might have missed because we weren't actively subscribed to them. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -79,7 +79,11 @@ impl<'a> ThreadView<'a> {
|
||||
}
|
||||
|
||||
let (len, list) = {
|
||||
let thread = self.app.threads.thread_mut(&self.app.ndb, &txn, root_id);
|
||||
let thread = self
|
||||
.app
|
||||
.threads
|
||||
.thread_mut(&self.app.ndb, &txn, root_id)
|
||||
.get_ptr();
|
||||
|
||||
let len = thread.view.notes.len();
|
||||
(len, &mut thread.view.list)
|
||||
@@ -92,7 +96,11 @@ impl<'a> ThreadView<'a> {
|
||||
ui.spacing_mut().item_spacing.x = 4.0;
|
||||
|
||||
let note_key = {
|
||||
let thread = self.app.threads.thread_mut(&self.app.ndb, &txn, root_id);
|
||||
let thread = self
|
||||
.app
|
||||
.threads
|
||||
.thread_mut(&self.app.ndb, &txn, root_id)
|
||||
.get_ptr();
|
||||
thread.view.notes[start_index].key
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user