diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_bd_svc.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_bd_svc.ts index d2fc339cdc..433c6acb17 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_bd_svc.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_bd_svc.ts @@ -39,10 +39,19 @@ export class DatabaseBackendService { return FolderEventCloseView(payload); }; - createRow = async (rowId?: string, groupId?: string) => { - const payload = CreateRowPayloadPB.fromObject({ view_id: this.viewId, start_row_id: rowId ?? undefined }); - if (groupId !== undefined) { - payload.group_id = groupId; + /// Create a row in database + /// 1.The row will be the last row in database if the params is undefined + /// 2.The row will be placed after the passed-in rowId + /// 3.The row will be moved to the group with groupId. Currently, grouping is + /// only support in kanban board. + createRow = async (params?: { rowId?: string; groupId?: string }) => { + const payload = CreateRowPayloadPB.fromObject({ view_id: this.viewId }); + if (params?.rowId !== undefined) { + payload.start_row_id = params.rowId; + } + + if (params?.groupId !== undefined) { + payload.group_id = params.groupId; } return DatabaseEventCreateRow(payload); }; diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/group/group_controller.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/group/group_controller.ts index 5077c3c017..1063cd7642 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/group/group_controller.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/group/group_controller.ts @@ -94,7 +94,7 @@ export class DatabaseGroupController { }; createRow = async () => { - return this.databaseBackendSvc.createRow(this.group.group_id); + return this.databaseBackendSvc.createRow({ groupId: this.group.group_id }); }; subscribe = (callbacks: GroupDataCallbacks) => {