Repository navigation
Commit a1df5ca
committed
fix(compiler): detect stale updates in deferred contexts inside Effect Events
effectEventDepth stayed elevated for the entire Effect Event visit, so
checkStaleUpdate was skipped after a nested await or in a timer/promise
callback scheduled from that event. Those closures still capture the
render snapshot from invocation time, making setN(n + 1) after
await save() or inside setTimeout a stale write.
Reset effectEventDepth to 0 in two places where deferred sub-contexts
are entered within an Effect Event body:
- visitStatements: when transitioning to deferred phase after an await
- Function visit: when visiting a function classified as an async
callback (e.g. setTimeout/promise callback)
Both save and restore the depth so outer Effect Event scopes remain
correctly suppressed.1 parent 7593104 commit a1df5ca
2 files changed
Lines changed: 24 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2222 | 2222 | | |
2223 | 2223 | | |
2224 | 2224 | | |
| 2225 | + | |
2225 | 2226 | | |
2226 | 2227 | | |
2227 | 2228 | | |
| |||
2239 | 2240 | | |
2240 | 2241 | | |
2241 | 2242 | | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
2242 | 2247 | | |
2243 | 2248 | | |
| 2249 | + | |
2244 | 2250 | | |
2245 | 2251 | | |
2246 | 2252 | | |
| |||
4118 | 4124 | | |
4119 | 4125 | | |
4120 | 4126 | | |
| 4127 | + | |
4121 | 4128 | | |
4122 | 4129 | | |
4123 | 4130 | | |
4124 | 4131 | | |
| 4132 | + | |
| 4133 | + | |
4125 | 4134 | | |
4126 | 4135 | | |
4127 | 4136 | | |
4128 | | - | |
4129 | | - | |
4130 | | - | |
4131 | | - | |
4132 | | - | |
| 4137 | + | |
4133 | 4138 | | |
4134 | 4139 | | |
4135 | 4140 | | |
| 4141 | + | |
4136 | 4142 | | |
4137 | 4143 | | |
4138 | 4144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
698 | 698 | | |
699 | 699 | | |
700 | 700 | | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
701 | 714 | | |
702 | 715 | | |
703 | 716 | | |
| |||
0 commit comments