fix: translate __orphan__ sentinel to null in bulk move; ungrouped units now fully bulk-operable

This commit is contained in:
Falkan
2026-03-17 18:32:03 -04:00
parent 91398174e6
commit f43f415cfa
2 changed files with 7 additions and 33 deletions

View File

@@ -125,12 +125,14 @@
if (bulkAction === 'move') {
if (!bulkMoveTargetGroupId || checkedUnitIds.size === 0) return;
formError = null;
// '__orphan__' is the sentinel value for "move to ungrouped" (group: null)
const targetGroup = bulkMoveTargetGroupId === '__orphan__' ? null : bulkMoveTargetGroupId;
const results = await Promise.all(
[...checkedUnitIds].map((unitId) =>
fetch(`/admin/api/units/${unitId}`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ group: bulkMoveTargetGroupId })
body: JSON.stringify({ group: targetGroup })
})
)
);