Commit 7a33508
authored
feat(scheduled-tasks): pause/resume, mutation toasts, submit guards, empty state (#5044)
* feat(scheduled-tasks): pause/resume, mutation toasts, submit guards, empty state
- Toasts on every job mutation (create/update/delete/exclude/pause/resume) so failures are never silent
- TaskModal stays open until the save persists; submit disabled in-flight to block double-submit
- Pause/Resume recurring tasks via the context menu; paused occurrences render dimmed so they stay resumable
- First-run empty state with a create CTA when the workspace has no tasks
* fix(scheduled-tasks): return edit-modal save promise so the modal awaits persistence
The edit TaskModal's onSubmit called updateTask without returning its promise,
so the await resolved immediately — the modal closed before the save finished,
failed edits didn't stay open, and a rejected mutateAsync went unhandled. Return
the promise so the await tracks the real mutation (matching the create path).
* refactor(scheduled-tasks): explicit return in edit-modal onSubmit for clarity
* fix(scheduled-tasks): optimistic create insert + always-reset submit guard
- Seed the created job into the workspace-list cache on success so the new task
renders instantly and the first-run empty state never flashes between the
success toast and the list refetch; onSettled still reconciles authoritatively.
- Reset the modal's submitting flag in a finally so the submit button can never
stick disabled if the modal is kept open.
* revert(scheduled-tasks): drop first-run empty state
Remove the empty-state prompt and its supporting hasTasks flag; with the empty
state gone, also revert the create optimistic-insert (its only purpose was
avoiding the empty-state flash) back to plain toast + list invalidation.
* fix(scheduled-tasks): lock modal dismiss while a save is in flight
Cancel, the header X, Escape, and overlay click all route through one guarded
onOpenChange that no-ops while submitting, and the footer Cancel is disabled
(cancelDisabled) — so an in-progress create/edit can't be abandoned mid-save and
lose its draft. submitting moves up to TaskModal so the guard can read it.
* fix(settings): align general appearance dropdowns to a uniform width
Theme/Snap-to-grid (ChipSelect) hugged their content (~90px) while Timezone
(ChipCombobox) was pinned to 260px, so the three read as a ragged column. Give
all three a shared 240px trigger via fullWidth + a common width wrapper so they
align as one column; menus match their triggers. No behavioral change — timezone
keeps search, options and handlers are untouched.
* docs(scheduled-tasks): document why the dismiss guard doesn't block the success-close
* fix(scheduled-tasks): disable Delete while an edit save is in flight
Delete bypasses the modal's dismiss guard (it closes via closeTask, not
onOpenChange), so a click mid-save could run a delete against the same task as
the in-flight update. Disable it while submitting, matching Cancel.
* refactor(scheduled-tasks): TSDoc over inline comments in task modal
Move the Delete-lock rationale to a TSDoc block on secondaryActions, and
restructure handleSubmit to a boolean persist result so the failure path is
self-evident — removing the inline comments and the empty catch block.
* fix(scheduled-tasks): gate submit on a synchronous ref to fully block double-submit
The submitting state flag only reflects after a re-render, so two same-tick
invocations (Enter racing the click) could both pass a state-based guard and fire
two mutations. A submittingRef flips synchronously, so the second invocation is
rejected before it can submit again; the state still drives the button/cancel UI.1 parent 6c56a21 commit 7a33508
9 files changed
Lines changed: 318 additions & 63 deletions
File tree
- apps/sim
- app/workspace/[workspaceId]
- scheduled-tasks
- components
- schedule-calendar/components/calendar-event-chip
- task-modal
- hooks
- utils
- settings/components/general
- hooks/queries
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| 54 | + | |
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
| |||
Lines changed: 24 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
27 | | - | |
28 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
| |||
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
| 42 | + | |
| 43 | + | |
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
| 47 | + | |
| 48 | + | |
40 | 49 | | |
41 | 50 | | |
42 | 51 | | |
| |||
67 | 76 | | |
68 | 77 | | |
69 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
70 | 91 | | |
71 | 92 | | |
72 | 93 | | |
| |||
Lines changed: 92 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
109 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
110 | 114 | | |
111 | 115 | | |
112 | 116 | | |
| |||
127 | 131 | | |
128 | 132 | | |
129 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
130 | 154 | | |
131 | 155 | | |
132 | 156 | | |
133 | | - | |
| 157 | + | |
134 | 158 | | |
135 | 159 | | |
136 | 160 | | |
137 | 161 | | |
138 | | - | |
| 162 | + | |
139 | 163 | | |
140 | 164 | | |
141 | 165 | | |
142 | 166 | | |
143 | 167 | | |
| 168 | + | |
| 169 | + | |
144 | 170 | | |
145 | 171 | | |
146 | 172 | | |
147 | 173 | | |
148 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
149 | 181 | | |
150 | 182 | | |
151 | 183 | | |
| |||
158 | 190 | | |
159 | 191 | | |
160 | 192 | | |
161 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
162 | 196 | | |
163 | 197 | | |
164 | 198 | | |
| |||
190 | 224 | | |
191 | 225 | | |
192 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
193 | 235 | | |
194 | 236 | | |
195 | 237 | | |
| |||
223 | 265 | | |
224 | 266 | | |
225 | 267 | | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
237 | 296 | | |
238 | 297 | | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
239 | 304 | | |
240 | 305 | | |
241 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
242 | 314 | | |
243 | 315 | | |
244 | 316 | | |
| |||
268 | 340 | | |
269 | 341 | | |
270 | 342 | | |
| 343 | + | |
271 | 344 | | |
272 | 345 | | |
273 | | - | |
| 346 | + | |
274 | 347 | | |
275 | | - | |
| 348 | + | |
276 | 349 | | |
277 | 350 | | |
278 | 351 | | |
| |||
Lines changed: 37 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
94 | | - | |
95 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
96 | 100 | | |
97 | 101 | | |
98 | 102 | | |
99 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
100 | 108 | | |
101 | 109 | | |
102 | 110 | | |
| |||
115 | 123 | | |
116 | 124 | | |
117 | 125 | | |
| 126 | + | |
| 127 | + | |
118 | 128 | | |
119 | 129 | | |
120 | 130 | | |
| |||
157 | 167 | | |
158 | 168 | | |
159 | 169 | | |
160 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
161 | 173 | | |
162 | 174 | | |
163 | 175 | | |
164 | 176 | | |
165 | 177 | | |
166 | | - | |
167 | | - | |
168 | | - | |
| 178 | + | |
| 179 | + | |
169 | 180 | | |
170 | 181 | | |
171 | 182 | | |
| |||
189 | 200 | | |
190 | 201 | | |
191 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
192 | 221 | | |
193 | 222 | | |
194 | 223 | | |
| |||
200 | 229 | | |
201 | 230 | | |
202 | 231 | | |
| 232 | + | |
| 233 | + | |
203 | 234 | | |
204 | 235 | | |
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
116 | 126 | | |
117 | 127 | | |
118 | 128 | | |
| |||
175 | 185 | | |
176 | 186 | | |
177 | 187 | | |
| 188 | + | |
| 189 | + | |
178 | 190 | | |
179 | 191 | | |
180 | 192 | | |
| |||
205 | 217 | | |
206 | 218 | | |
207 | 219 | | |
208 | | - | |
| 220 | + | |
209 | 221 | | |
210 | 222 | | |
211 | 223 | | |
| |||
0 commit comments