Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

chore: move row into other block

ascarbekfa427fe6507d
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/_shared/database-hooks/useDatabase.ts b/frontend/appflowy_tauri/src/appflowy_app/components/_shared/database-hooks/useDatabase.ts
index 8811c92114..4322623d00 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/_shared/database-hooks/useDatabase.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/_shared/database-hooks/useDatabase.ts
@@ -82,12 +82,18 @@ export const useDatabase = (viewId: string, type?: ViewLayoutTypePB) => {
};
const onDragEnd: OnDragEndResponder = async (result) => {
+ if (!controller) return;
const { source, destination } = result;
- // move inside the block (group)
+ const group = groups.find((g) => g.groupId === source.droppableId);
+ if (!group) return;
+
if (source.droppableId === destination?.droppableId) {
- const group = groups.find((g) => g.groupId === source.droppableId);
- if (!group || !controller) return;
+ // move inside the block (group)
await controller.exchangeRow(group.rows[source.index].id, group.rows[destination.index].id);
+ } else {
+ // move to different block (group)
+ if (!destination?.droppableId) return;
+ await controller.moveRow(group.rows[source.index].id, destination.droppableId);
}
};