fix: stuck when importing large csv file (#4878)

* chore: fix import csv file

* chore: update collab

* chore: bump collab

* chore: workaround for row creating

* fix: test
This commit is contained in:
Nathan.fooo
2024-03-12 10:59:52 +08:00
committed by GitHub
parent c48001bd74
commit 9c3be7e488
23 changed files with 169 additions and 85 deletions

View File

@ -8,6 +8,7 @@ use flowy_user::entities::{
};
use flowy_user::errors::FlowyError;
use flowy_user::event_map::UserEvent;
use tokio::time::sleep;
use crate::event_builder::EventBuilder;
use crate::EventIntegrationTest;
@ -134,6 +135,15 @@ impl EventIntegrationTest {
.await
.parse::<ViewPB>()
}
pub async fn import_data(&self, data: ImportPB) -> ViewPB {
EventBuilder::new(self.clone())
.event(FolderEvent::ImportData)
.payload(data)
.async_send()
.await
.parse::<ViewPB>()
}
}
pub struct ViewTest {
@ -172,15 +182,23 @@ impl ViewTest {
}
pub async fn new_grid_view(sdk: &EventIntegrationTest, data: Vec<u8>) -> Self {
Self::new(sdk, ViewLayoutPB::Grid, data).await
// TODO(nathan): remove this sleep
// workaround for the rows that are created asynchronously
let this = Self::new(sdk, ViewLayoutPB::Grid, data).await;
sleep(tokio::time::Duration::from_secs(2)).await;
this
}
pub async fn new_board_view(sdk: &EventIntegrationTest, data: Vec<u8>) -> Self {
Self::new(sdk, ViewLayoutPB::Board, data).await
let this = Self::new(sdk, ViewLayoutPB::Board, data).await;
sleep(tokio::time::Duration::from_secs(2)).await;
this
}
pub async fn new_calendar_view(sdk: &EventIntegrationTest, data: Vec<u8>) -> Self {
Self::new(sdk, ViewLayoutPB::Calendar, data).await
let this = Self::new(sdk, ViewLayoutPB::Calendar, data).await;
sleep(tokio::time::Duration::from_secs(2)).await;
this
}
}