fix(discovery): drain filtered refresh pages without incremental batches

This commit is contained in:
objz committed 2026-09-25 09:45:36 +02:00
1 parent 38cd978f29
commit 884a0b6df3
3 files changed
+39 -1

No files matched your search

@@ -1712,6 +1712,40 @@ fn search_refresh_keeps_rows_until_the_diff_arrives() {
assert!(!state.list.loading);
}
#[test]
fn filtered_refresh_applies_a_provider_page_in_one_frame() {
let mut state = DiscoveryState::new(ContentKind::Mod);
let instance = instance("one", "1.21.1");
let initial = state.begin_search(&instance);
initial.stream.upsert(project_entry(project("old"), None));
drain_discovery_rows(&mut state);
state.filter_panel_selected = state.category_start();
state.apply_selected_filter();
assert!(!state.filters.categories.is_empty());
let refresh = state.begin_search(&instance);
assert!(refresh.reconcile);
let stems = (0..8)
.map(|index| {
let project = project(&format!("new-{index}"));
let stem = project.id.clone();
refresh.stream.upsert(project_entry(project, None));
stem
})
.collect();
refresh.stream.order(stems);
state.list.drain_pending();
assert_eq!(state.list.entries.len(), 8);
assert!(
state
.list
.entries
.iter()
.all(|entry| entry.name.starts_with("new-"))
);
}
#[test]
fn rapidly_cycling_a_category_discards_superseded_rows_and_results() {
let mut state = DiscoveryState::new(ContentKind::Mod);
+3 -1
View File
@@ -1456,7 +1456,9 @@ impl DiscoveryState {
} else {
self.list.start_source_stream(context)
};
self.list.show_source_rows_progressively();
if !reconcile {
self.list.show_source_rows_progressively();
}
self.list.search.query.clone_from(&self.search.query);
self.list.set_search_filtering(false);
self.stream = Some(stream.clone());
+2
View File
@@ -692,6 +692,7 @@ impl ContentListState {
let (sender, receiver) = mpsc::channel();
self.stream_rx = Some(receiver);
self.stream_order = ContentStreamOrder::Source;
self.progressive_source_stream = false;
self.preview_count = 0;
self.loaded_for = Some(source.into());
ContentStream { sender }
@@ -1001,6 +1002,7 @@ impl ContentListState {
self.pending_entry_images
.retain(|stem| positions.contains_key(stem.as_str()));
self.preview_count = 0;
self.progressive_source_stream = true;
self.images_dirty = true;
}
Ok(ContentStreamUpdate::Icon {