fix: use .get() instead of .with() for RwSignal and fix indentation
All checks were successful
Build MIPS Binary / build (push) Successful in 5m21s
All checks were successful
Build MIPS Binary / build (push) Successful in 5m21s
This commit is contained in:
@@ -51,13 +51,14 @@ pub fn TorrentTable() -> impl IntoView {
|
||||
let sort_dir = signal(SortDirection::Descending);
|
||||
|
||||
let filtered_hashes = move || {
|
||||
store.torrents.with(|map| {
|
||||
let count = map.len();
|
||||
log::debug!("TorrentTable: store.torrents has {} entries", count);
|
||||
let torrents_map = store.torrents.get();
|
||||
log::debug!("TorrentTable: store.torrents has {} entries", torrents_map.len());
|
||||
|
||||
let mut torrents: Vec<&shared::Torrent> = map.values().filter(|t| {
|
||||
let filter = store.filter.get();
|
||||
let search = store.search_query.get().to_lowercase();
|
||||
let search = store.search_query.get();
|
||||
let search_lower = search.to_lowercase();
|
||||
|
||||
let mut torrents: Vec<&shared::Torrent> = torrents_map.values().filter(|t| {
|
||||
let matches_filter = match filter {
|
||||
crate::store::FilterStatus::All => true,
|
||||
crate::store::FilterStatus::Downloading => t.status == shared::TorrentStatus::Downloading,
|
||||
@@ -67,7 +68,7 @@ pub fn TorrentTable() -> impl IntoView {
|
||||
crate::store::FilterStatus::Inactive => t.status == shared::TorrentStatus::Paused || t.status == shared::TorrentStatus::Error,
|
||||
_ => true,
|
||||
};
|
||||
let matches_search = if search.is_empty() { true } else { t.name.to_lowercase().contains(&search) };
|
||||
let matches_search = if search_lower.is_empty() { true } else { t.name.to_lowercase().contains(&search_lower) };
|
||||
matches_filter && matches_search
|
||||
}).collect();
|
||||
|
||||
@@ -93,7 +94,6 @@ pub fn TorrentTable() -> impl IntoView {
|
||||
if dir == SortDirection::Descending { cmp.reverse() } else { cmp }
|
||||
});
|
||||
torrents.into_iter().map(|t| t.hash.clone()).collect::<Vec<String>>()
|
||||
})
|
||||
};
|
||||
|
||||
let handle_sort = move |col: SortColumn| {
|
||||
|
||||
Reference in New Issue
Block a user