From 02ea804aa0d4b6fe091950fb23b40fce7e7d9fbc Mon Sep 17 00:00:00 2001 From: adarsh-rs Date: Wed, 7 Aug 2024 22:23:25 +0530 Subject: [PATCH 1/2] Fix: fix buggy overlay experience pop-up login after every 4 scrolls for non-logged-in user --- ssr/src/page/post_view/mod.rs | 2 +- ssr/src/page/post_view/video_loader.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ssr/src/page/post_view/mod.rs b/ssr/src/page/post_view/mod.rs index d234ce7c..b6a568aa 100644 --- a/ssr/src/page/post_view/mod.rs +++ b/ssr/src/page/post_view/mod.rs @@ -176,7 +176,7 @@ pub fn PostViewWithUpdates(initial_post: Option) -> impl IntoView { video_queue.update_untracked(|v| { if v.len() > 1 { // Safe to do a GC here - let rem = 0..(current_idx.get_untracked().saturating_sub(3)); + let rem = 0..(current_idx.get_untracked().saturating_sub(5)); current_idx.update(|c| *c -= rem.len()); v.drain(rem); return; diff --git a/ssr/src/page/post_view/video_loader.rs b/ssr/src/page/post_view/video_loader.rs index 9de1a207..f38eaa22 100644 --- a/ssr/src/page/post_view/video_loader.rs +++ b/ssr/src/page/post_view/video_loader.rs @@ -35,8 +35,10 @@ pub fn BgView( let (referrer_store, _, _) = use_referrer_store(); create_effect(move |_| { - if current_idx.get() == 5 { + if current_idx.get() % 4 != 0 { set_show_login_popup.update(|n| *n = false); + } else { + set_show_login_popup.update(|n| *n = true); } Some(()) }); @@ -48,7 +50,7 @@ pub fn BgView( style:background-color="rgb(0, 0, 0)" style:background-image=move || format!("url({})", bg_url(uid())) > - + - +