Skip to content

Commit 3133458

Browse files
committed
docs(scheduled-tasks): document why the dismiss guard doesn't block the success-close
1 parent 79d40f7 commit 3133458

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/scheduled-tasks/components/task-modal

apps/sim/app/workspace/[workspaceId]/scheduled-tasks/components/task-modal/task-modal.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ export function TaskModal({
138138
* Escape, and overlay click all route through this one handler — so an
139139
* in-progress create/edit can't be abandoned and lose its draft. `submitting`
140140
* lives here (not in the unmounted-on-close content) so this guard can see it.
141+
*
142+
* The programmatic close on a *successful* submit is intentionally NOT blocked:
143+
* `handleSubmit` runs in the pre-submit render where `submitting` was still
144+
* false, so its `close()` resolves to that render's handler and passes through,
145+
* while user dismisses fire from the current (submitting) render and are caught
146+
* here. Keep `submitting` as render state — moving it to a ref or memoizing this
147+
* handler with `submitting` in deps would make the success-close start blocking.
141148
*/
142149
const handleOpenChange = (next: boolean) => {
143150
if (!next && submitting) return

0 commit comments

Comments
 (0)