Commit aff62c7
committed
Fix duplicate keyUp after interrupt in performAutomationPress
In performAutomationPress, the send helper dispatches the CDP keyUp
command and then checks the control epoch. If human input bumps the
epoch between CDP dispatch and the post-check, send fails with
PreviewAutomationControlInterruptedError before keyReleased is set to
true. The Effect.ensuring cleanup then sends a second keyUp via
sendCleanup, duplicating the release.
Fix by snapshotting the epoch before the keyUp send and using
Effect.tapError to detect when the epoch changed during the call.
Since the epoch snapshot and send's pre-check are both synchronous
Ref reads with no async operations in between, a changed epoch in
tapError means the pre-check passed (CDP was dispatched) and only
the post-check failed. Mark keyReleased = true in that case to
prevent the cleanup from issuing a duplicate keyUp.1 parent 239e8b2 commit aff62c7
1 file changed
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2226 | 2226 | | |
2227 | 2227 | | |
2228 | 2228 | | |
2229 | | - | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
2230 | 2244 | | |
2231 | 2245 | | |
2232 | 2246 | | |
| |||
0 commit comments