Explorar el Código

feat: invalidate target item's data before expanding in drag-and-drop

Yuki Takei hace 4 meses
padre
commit
d3421870d4
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      apps/app/src/features/page-tree/hooks/use-page-dnd.tsx

+ 3 - 1
apps/app/src/features/page-tree/hooks/use-page-dnd.tsx

@@ -238,7 +238,9 @@ export const usePageDnd = (): UsePageDndResult => {
       // Invalidate headless-tree items (source parents and target)
       notifyUpdateItems(Array.from(parentIdsToInvalidate));
 
-      // Expand drop target
+      // Invalidate target item's data (descendantCount changed) and expand it
+      // Use await to ensure data is refreshed before expanding
+      await targetItem.invalidateItemData();
       targetItem.expand();
 
       return { success: true };