@@ -259,13 +259,16 @@ export function createThreadEnvironmentAtoms<R, E>(
259259 return {
260260 ...commands ,
261261 snapshotAtom : optimistic . snapshotAtom ,
262- settle : optimistic . wrap ( commands . settle , ( thread , _input , now ) =>
263- ! canSnooze ( thread , { now } ) ||
264- thread . session ?. status === "starting" ||
265- thread . session ?. status === "running"
262+ settle : optimistic . wrap ( commands . settle , ( thread , _input , now , accepted ) =>
263+ ! accepted &&
264+ ( ! canSnooze ( thread , { now } ) ||
265+ thread . session ?. status === "starting" ||
266+ thread . session ?. status === "running" )
266267 ? thread
267268 : {
268269 ...thread ,
270+ hasPendingApprovals : false ,
271+ hasPendingUserInput : false ,
269272 settledOverride : "settled" ,
270273 settledAt : thread . settledOverride === "settled" ? ( thread . settledAt ?? now ) : now ,
271274 unsettledAt : null ,
@@ -282,11 +285,14 @@ export function createThreadEnvironmentAtoms<R, E>(
282285 settledAt : null ,
283286 unsettledAt : thread . settledOverride === "active" ? ( thread . unsettledAt ?? null ) : now ,
284287 } ) ) ,
285- snooze : optimistic . wrap ( commands . snooze , ( thread , input , now ) =>
286- ! canSnooze ( thread , { now } ) || ! ( Date . parse ( input . snoozedUntil ) > Date . parse ( now ) )
288+ snooze : optimistic . wrap ( commands . snooze , ( thread , input , now , accepted ) =>
289+ ( ! accepted && ! canSnooze ( thread , { now } ) ) ||
290+ ! ( Date . parse ( input . snoozedUntil ) > Date . parse ( now ) )
287291 ? thread
288292 : {
289293 ...thread ,
294+ hasPendingApprovals : false ,
295+ hasPendingUserInput : false ,
290296 snoozedUntil : input . snoozedUntil ,
291297 snoozedAt : thread . snoozedUntil === input . snoozedUntil ? ( thread . snoozedAt ?? now ) : now ,
292298 } ,
0 commit comments