AppFlowy/frontend/rust-lib/flowy-folder/src/util.rs
Nathan.fooo fda70ff560
feat: folder web (#4580)
* chore: folder wasm

* chore: folder wasm

* chore: resolve deps

* chore: fix trait

* chore: try localset

* chore: fix

* chore: fix

* chore: fix

* chore: async init sdk

* chore: fix test

* chore: fix test
2024-02-04 05:50:23 +08:00

31 lines
962 B
Rust

use crate::entities::UserFolderPB;
use collab_folder::Folder;
use flowy_error::{ErrorCode, FlowyError};
use flowy_folder_pub::folder_builder::ParentChildViews;
use tracing::{event, instrument};
pub(crate) fn folder_not_init_error() -> FlowyError {
FlowyError::internal().with_context("Folder not initialized")
}
pub(crate) fn workspace_data_not_sync_error(uid: i64, workspace_id: &str) -> FlowyError {
FlowyError::from(ErrorCode::WorkspaceDataNotSync).with_payload(UserFolderPB {
uid,
workspace_id: workspace_id.to_string(),
})
}
#[instrument(level = "debug", skip(folder, view))]
pub(crate) fn insert_parent_child_views(folder: &Folder, view: ParentChildViews) {
event!(
tracing::Level::DEBUG,
"Inserting view: {}, view children: {}",
view.parent_view.id,
view.child_views.len()
);
folder.insert_view(view.parent_view, None);
for child_view in view.child_views {
insert_parent_child_views(folder, child_view);
}
}