Commit f613c1b
authored
Delete batched callback before calling (#202)
If a `callback` within `batchedCallbacks` calls `assign` we have an
infinite loop. Removing the callback from `batchedCallbacks` before
executing it breaks this loop.
Consider a callback calling `assign`. `assign` will call `batch`, which
will loop through all `batchedCallbacks` and execute each one. If one of
those callbacks calls `assign` we will continue indefinitely.
By first removing the callback from `batchedCallbacks`, then executing
we ensure that when the callback calls `assign` the callback is no
longer part of the enqueued `batchedCallbacks`.1 parent bbb5863 commit f613c1b
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
0 commit comments