Skip to content

Commit 6547592

Browse files
fix(mobile): delete a pending task open in the editor without the slide-out
The editor shares the delivery hold, so closing it during the row animation would release the delete's hold and let the drain send the task. Remove it immediately in that case, as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent d82041a commit 6547592

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

‎apps/mobile/src/features/home/usePendingTaskListActions.ts‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,20 @@ export function usePendingTaskListActions(): {
6868
onPress: () => {
6969
// The row animates out before removal runs, so hold delivery from
7070
// confirmation on: a reconnect must not send a task being deleted.
71-
// A lock the editor already held stays held unless removal succeeds.
71+
// The hold is shared with the editor, which could release it
72+
// mid-animation, so a task open in the editor is removed at once
73+
// and keeps its hold unless removal succeeds.
7274
const messageId = pendingTask.message.messageId;
7375
const heldByEditor = appAtomRegistry.get(editingQueuedMessageIdsAtom)[messageId];
7476
holdEditingQueuedMessage(messageId);
7577
const releaseUnlessEditing = () => {
7678
if (!heldByEditor) releaseEditingQueuedMessage(messageId);
7779
};
78-
void withThreadDismissal(
79-
pendingTask.key,
80-
() => removeThreadOutboxMessage(pendingTask.message),
81-
(removed) => removed,
80+
const remove = () => removeThreadOutboxMessage(pendingTask.message);
81+
void (
82+
heldByEditor
83+
? remove()
84+
: withThreadDismissal(pendingTask.key, remove, (removed) => removed)
8285
)
8386
.then((removed) =>
8487
removed ? releaseEditingQueuedMessage(messageId) : releaseUnlessEditing(),

0 commit comments

Comments
 (0)