notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit 247feb9e2686ec364ebf509183414338ebe0e200
parent 50aa21b2f03f1cb6ce6ecfa3319b56243a1b7826
Author: William Casarin <jb55@jb55.com>
Date:   Wed, 13 Mar 2024 13:24:06 +0000

filter: unify nostrdb and remote limits

Before we were setting filter limits in two different places. Let's
unify them so we don't have to sources of truth for filter limits.

Diffstat:
Msrc/app.rs | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/app.rs b/src/app.rs @@ -127,8 +127,8 @@ fn relay_setup(pool: &mut RelayPool, ctx: &egui::Context) { } } -fn get_home_filter() -> Filter { - Filter::new().limit(100).kinds(vec![1, 42]).pubkeys( +fn get_home_filter(limit: u16) -> Filter { + Filter::new().limit(limit).kinds(vec![1, 42]).pubkeys( [ Pubkey::from_hex("32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245") .unwrap(), @@ -300,7 +300,11 @@ fn setup_initial_nostrdb_subs(damus: &mut Damus) -> Result<()> { .collect(); damus.timelines[0].subscription = Some(damus.ndb.subscribe(filters.clone())?); let txn = Transaction::new(&damus.ndb)?; - let res = damus.ndb.query(&txn, filters, 100)?; + let res = damus.ndb.query( + &txn, + filters, + damus.initial_filter[0].limit.unwrap_or(1000) as i32, + )?; damus.timelines[0].notes = res .iter() .map(|qr| NoteRef { @@ -434,10 +438,11 @@ impl Damus { egui_extras::install_image_loaders(&cc.egui_ctx); + let initial_limit = 100; let initial_filter = if args.len() > 1 { serde_json::from_str(&args[1]).unwrap() } else { - vec![get_home_filter()] + vec![get_home_filter(initial_limit)] }; let imgcache_dir = data_path.as_ref().join("cache/img");