From 75bc7495bd2f3014feff9f30056099c49c3a248e Mon Sep 17 00:00:00 2001 From: appflowy Date: Thu, 27 Jan 2022 15:34:31 +0800 Subject: [PATCH] fix folder editor not initialize after hot reload --- frontend/rust-lib/flowy-core/src/controller.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/rust-lib/flowy-core/src/controller.rs b/frontend/rust-lib/flowy-core/src/controller.rs index e4a6b07f79..79f04815a6 100755 --- a/frontend/rust-lib/flowy-core/src/controller.rs +++ b/frontend/rust-lib/flowy-core/src/controller.rs @@ -74,6 +74,12 @@ impl FolderManager { document_manager: Arc, web_socket: Arc, ) -> Self { + if let Ok(user_id) = user.user_id() { + // Reset the flag if the folder manager gets initialized, otherwise, + // the folder_editor will not be initialized after flutter hot reload. + INIT_FOLDER_FLAG.write().await.insert(user_id.to_owned(), false); + } + let folder_editor = Arc::new(TokioRwLock::new(None)); let persistence = Arc::new(FolderPersistence::new(database.clone(), folder_editor.clone()));