From f1c470a8a3797367b321fc809e3e7933e6a50758 Mon Sep 17 00:00:00 2001 From: Lars Date: Sat, 16 May 2026 08:05:10 +0200 Subject: [PATCH] Improve section movement validation in TrainingUnitSectionsEditor - Added a check to ensure that the source slot is not the same as the target slot when moving sections across slots, enhancing the logic for section management and preventing unnecessary operations. --- frontend/src/components/TrainingUnitSectionsEditor.jsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/TrainingUnitSectionsEditor.jsx b/frontend/src/components/TrainingUnitSectionsEditor.jsx index c0cf4c3..e7fa968 100644 --- a/frontend/src/components/TrainingUnitSectionsEditor.jsx +++ b/frontend/src/components/TrainingUnitSectionsEditor.jsx @@ -773,7 +773,8 @@ export default function TrainingUnitSectionsEditor({ if ( typeof onMoveSectionsAcrossSlots === 'function' && sectionToSlot >= 0 && - fromSlot >= 0 + fromSlot >= 0 && + fromSlot !== sectionToSlot ) { return { kind: 'crossSlot', fromSi, fromSlot } } @@ -937,7 +938,8 @@ export default function TrainingUnitSectionsEditor({ if ( typeof onMoveSectionsAcrossSlots === 'function' && sectionToSlot >= 0 && - fromSlot >= 0 + fromSlot >= 0 && + fromSlot !== sectionToSlot ) { onMoveSectionsAcrossSlots({ fromSlot, @@ -1011,7 +1013,8 @@ export default function TrainingUnitSectionsEditor({ if ( typeof onMoveSectionsAcrossSlots === 'function' && sectionToSlot >= 0 && - fromSlot >= 0 + fromSlot >= 0 && + fromSlot !== sectionToSlot ) { onMoveSectionsAcrossSlots({ fromSlot,