fix: duplicate grid

This commit is contained in:
appflowy
2022-06-06 20:06:08 +08:00
parent 7c03924e9c
commit 8fd9b68d9d
15 changed files with 150 additions and 60 deletions

View File

@ -241,11 +241,11 @@ pub trait ViewDataProcessor {
fn close_container(&self, view_id: &str) -> FutureResult<(), FlowyError>;
fn delta_bytes(&self, view_id: &str) -> FutureResult<Bytes, FlowyError>;
fn view_delta_data(&self, view_id: &str) -> FutureResult<Bytes, FlowyError>;
fn create_default_view(&self, user_id: &str, view_id: &str) -> FutureResult<Bytes, FlowyError>;
fn process_create_view_data(&self, user_id: &str, view_id: &str, data: Vec<u8>) -> FutureResult<Bytes, FlowyError>;
fn process_view_delta_data(&self, user_id: &str, view_id: &str, data: Vec<u8>) -> FutureResult<Bytes, FlowyError>;
fn data_type(&self) -> ViewDataType;
}

View File

@ -60,7 +60,7 @@ impl ViewController {
params.data = view_data.to_vec();
} else {
let delta_data = processor
.process_create_view_data(&user_id, &params.view_id, params.data.clone())
.process_view_delta_data(&user_id, &params.view_id, params.data.clone())
.await?;
let _ = self
.create_view(&params.view_id, params.data_type.clone(), delta_data)
@ -176,7 +176,7 @@ impl ViewController {
.await?;
let processor = self.get_data_processor(&view.data_type)?;
let delta_bytes = processor.delta_bytes(view_id).await?;
let delta_bytes = processor.view_delta_data(view_id).await?;
let duplicate_params = CreateViewParams {
belong_to_id: view.belong_to_id.clone(),
name: format!("{} (copy)", &view.name),
@ -238,7 +238,7 @@ impl ViewController {
}
impl ViewController {
#[tracing::instrument(level = "debug", skip(self), err)]
#[tracing::instrument(level = "debug", skip(self, params), err)]
async fn create_view_on_server(&self, params: CreateViewParams) -> Result<View, FlowyError> {
let token = self.user.token()?;
let view = self.cloud_service.create_view(&token, params).await?;