chore: check workspace id before write to disk (#5197)

* chore: check workspace id before write to disk

* chore: update logs

* chore: update logs

* chore: update ci

* chore: bump client api
This commit is contained in:
Nathan.fooo
2024-04-24 14:38:47 +08:00
committed by GitHub
parent d21d095f0b
commit 6ecbf971b2
25 changed files with 204 additions and 142 deletions

View File

@ -77,11 +77,19 @@ pub struct AppFlowyCollabBuilder {
pub struct CollabBuilderConfig {
pub sync_enable: bool,
/// If auto_initialize is false, the collab object will not be initialized automatically.
/// You need to call collab.initialize() manually.
///
/// Default is true.
pub auto_initialize: bool,
}
impl Default for CollabBuilderConfig {
fn default() -> Self {
Self { sync_enable: true }
Self {
sync_enable: true,
auto_initialize: true,
}
}
}
@ -90,6 +98,11 @@ impl CollabBuilderConfig {
self.sync_enable = sync_enable;
self
}
pub fn auto_initialize(mut self, auto_initialize: bool) -> Self {
self.auto_initialize = auto_initialize;
self
}
}
impl AppFlowyCollabBuilder {
@ -292,11 +305,13 @@ impl AppFlowyCollabBuilder {
}
}
#[cfg(target_arch = "wasm32")]
futures::executor::block_on(arc_collab.lock().initialize());
if build_config.auto_initialize {
#[cfg(target_arch = "wasm32")]
futures::executor::block_on(arc_collab.lock().initialize());
#[cfg(not(target_arch = "wasm32"))]
arc_collab.lock().initialize();
#[cfg(not(target_arch = "wasm32"))]
arc_collab.lock().initialize();
}
trace!("collab initialized: {}:{}", object_type, object_id);
Ok(arc_collab)