Skip to content

Commit 99228ca

Browse files
committed
fix: a parked group dropped in Active lands where it was dropped
1 parent a1449a5 commit 99228ca

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

‎apps/web/src/components/Sidebar.tsx‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4648,6 +4648,34 @@ export default function Sidebar() {
46484648
)
46494649
return;
46504650
}
4651+
// A group whose top thread is parked sits at one of its live threads,
4652+
// and which one can change as members unpin. Give every live member
4653+
// the dropped key so the group lands where it was dropped either way.
4654+
if (
4655+
plan.kind === "move-active" &&
4656+
plan.order !== null &&
4657+
droppedGroup !== undefined &&
4658+
droppedGroup.block.key !== activeKey
4659+
) {
4660+
const orderKey =
4661+
plan.assignments.find((assignment) => assignment.id === activeKey)?.orderKey ??
4662+
activeKeysById.get(activeKey);
4663+
if (orderKey == null) return;
4664+
for (const row of droppedGroup.block.rows) {
4665+
if (row.key === activeKey || row.section === "snoozed" || row.section === "settled")
4666+
continue;
4667+
if (
4668+
!(await run(
4669+
reorderActiveThread(
4670+
scopeThreadRef(row.thread.environmentId, row.thread.id),
4671+
orderKey,
4672+
),
4673+
"Failed to reorder active threads",
4674+
))
4675+
)
4676+
return;
4677+
}
4678+
}
46514679
})();
46524680
},
46534681
[

0 commit comments

Comments
 (0)