From 9951c2fea6d1b8d22761388ce285346c9edb0df4 Mon Sep 17 00:00:00 2001 From: Adrien Date: Fri, 12 Apr 2024 14:39:23 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20Remove=20the=20use=20of=20Loadin?= =?UTF-8?q?gPage=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For now, the LoadingPage component is kept, just in case. --- src/main.rs | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/src/main.rs b/src/main.rs index e96cfb7..a42630b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,9 +5,6 @@ mod infrastructure; mod ui; mod utils; -use std::time::Duration; - -use async_std::task; use dioxus::prelude::*; #[cfg(feature = "desktop")] @@ -21,7 +18,6 @@ use tracing_web::MakeWebConsoleWriter; use crate::base::{login, sync_rooms}; use crate::base::{APP_SETTINGS, ROOMS, SESSION}; -use crate::ui::components::loading::LoadingPage; use crate::ui::components::login::Login; use crate::ui::components::main_window::MainWindow; @@ -30,17 +26,6 @@ mod base; fn app() -> Element { debug!("*** App rendering ***"); - let mut ready = use_signal(|| false); - - // Dummy timer simulating the loading of the application - let _: Coroutine<()> = use_coroutine(|_: UnboundedReceiver<_>| async move { - debug!("Not ready"); - task::sleep(Duration::from_secs(3)).await; - // task::sleep(Duration::from_secs(0)).await; - debug!("Ready"); - ready.set(true); - }); - let login_coro = use_coroutine(|rx| login(rx, &APP_SETTINGS, &SESSION)); let mut sync_rooms_coro = None; @@ -100,20 +85,14 @@ fn app() -> Element { // } } - if *ready.read() { - if SESSION.read().is_logged { - debug!("Should render the MainWindow component"); - rsx! { - MainWindow {}, - } - } else { - rsx! { - Login {}, - } + if SESSION.read().is_logged { + debug!("Should render the MainWindow component"); + rsx! { + MainWindow {}, } } else { rsx! { - LoadingPage {}, + Login {}, } } }