Skip to content

Commit 4d787ab

Browse files
fix(mobile): defer draft sheet navigation by one frame
1 parent 2381e0f commit 4d787ab

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎apps/mobile/src/features/threads/NewTaskDraftScreen.tsx‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,13 @@ export function NewTaskDraftScreen(props: {
289289
if (preventRemove || submitNavigationAction === null) {
290290
return;
291291
}
292-
// setSubmitting(false) does not release the guard synchronously. Navigate
293-
// after usePreventRemove has committed, for both sent and queued tasks.
294-
setSubmitNavigationAction(null);
295-
(navigation.getParent() ?? navigation).dispatch(submitNavigationAction);
292+
// Give the guard update a frame to reach the parent sheet before navigating,
293+
// just like the project-picker fallback below.
294+
const frame = requestAnimationFrame(() => {
295+
setSubmitNavigationAction(null);
296+
(navigation.getParent() ?? navigation).dispatch(submitNavigationAction);
297+
});
298+
return () => cancelAnimationFrame(frame);
296299
}, [navigation, preventRemove, submitNavigationAction]);
297300
const hasImportedIncomingShare = Boolean(
298301
props.incomingShareId &&

0 commit comments

Comments
 (0)