Browse Source

[rust]: Reset INIT_WORKSPACE flag for flutter's hot reload

appflowy 3 years ago
parent
commit
fa683e48c0

+ 1 - 1
app_flowy/macos/Podfile.lock

@@ -70,4 +70,4 @@ SPEC CHECKSUMS:
 
 PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
 
-COCOAPODS: 1.11.2
+COCOAPODS: 1.10.1

+ 1 - 0
rust-lib/flowy-document/src/services/doc/revision/persistence.rs

@@ -206,6 +206,7 @@ async fn fetch_from_local(doc_id: &str, persistence: Arc<Persistence>) -> DocRes
                 let data = op.get_data();
                 if !data.ends_with("\n") {
                     log::error!("The op must end with newline");
+                    log::debug!("Invalid delta: {}", delta.to_json());
                 }
             },
         }

+ 6 - 0
rust-lib/flowy-workspace/src/services/workspace_controller.rs

@@ -39,6 +39,10 @@ impl WorkspaceController {
         trash_can: Arc<TrashCan>,
         server: Server,
     ) -> Self {
+        if let Ok(token) = user.token() {
+            INIT_WORKSPACE.write().insert(token, false);
+        }
+
         let workspace_sql = Arc::new(WorkspaceTableSql {});
         Self {
             user,
@@ -52,11 +56,13 @@ impl WorkspaceController {
     }
 
     async fn init(&self, token: &str) -> Result<(), WorkspaceError> {
+        log::debug!("Start initializing workspace");
         if let Some(is_init) = INIT_WORKSPACE.read().get(token) {
             if *is_init {
                 return Ok(());
             }
         }
+        log::debug!("Finish initializing workspace");
         INIT_WORKSPACE.write().insert(token.to_owned(), true);
         let _ = self.server.init();
         let _ = self.trash_can.init()?;