Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: fix sidebar items are not reorderable

Abdullah Atta3a5ea3e8ef5f
diff --git a/apps/web/src/components/navigation-menu/index.tsx b/apps/web/src/components/navigation-menu/index.tsx
index 250372728..49232bd9e 100644
--- a/apps/web/src/components/navigation-menu/index.tsx
+++ b/apps/web/src/components/navigation-menu/index.tsx
@@ -572,7 +572,9 @@ function ReorderableList<T extends { id: string }>(
const overId = over?.id as string;
if (overId && active.id !== overId) {
const transitionOrder =
- order.length === 0 ? orderedItems.map((i) => i.id) : order;
+ order.length === 0 || order.length !== orderedItems.length
+ ? orderedItems.map((i) => i.id)
+ : order;
const newIndex = transitionOrder.indexOf(overId);
const oldIndex = transitionOrder.indexOf(active.id as string);
const newOrder = arrayMove(transitionOrder, oldIndex, newIndex);