Commit 8888746
authored
Allow transitions to interrupt Suspensey commits (#26531)
I originally made it so that a Suspensey commit — i.e. a commit that's
waiting for a stylesheet, image, or font to load before proceeding —
could not be interrupted by transitions. My reasoning was that Suspensey
commits always time out after a short interval, anyway, so if the
incoming update isn't urgent, it's better to wait to commit the current
frame instead of throwing it away.
I don't think this rationale was correct, for a few reasons. There are
some cases where we'll suspend for a longer duration, like stylesheets —
it's nearly always a bad idea to show content before its styles have
loaded, so we're going to be extend this timeout to be really long.
But even in the case where the timeout is shorter, like fonts, if you
get a new update, it's possible (even likely) that update will allow us
to avoid showing a fallback, like by navigating to a different page. So
we might as well try.
The behavior now matches our behavior for interrupting a suspended
render phase (i.e. `use`), which makes sense because they're not that
conceptually different.1 parent 09c8d25 commit 8888746
File tree
4 files changed
+40
-65
lines changed- packages
- react-dom/src/__tests__
- react-reconciler/src
- __tests__
4 files changed
+40
-65
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3216 | 3216 | | |
3217 | 3217 | | |
3218 | 3218 | | |
3219 | | - | |
| 3219 | + | |
3220 | 3220 | | |
3221 | 3221 | | |
3222 | 3222 | | |
| |||
3225 | 3225 | | |
3226 | 3226 | | |
3227 | 3227 | | |
3228 | | - | |
| 3228 | + | |
| 3229 | + | |
| 3230 | + | |
3229 | 3231 | | |
3230 | 3232 | | |
3231 | 3233 | | |
3232 | | - | |
3233 | | - | |
| 3234 | + | |
| 3235 | + | |
3234 | 3236 | | |
3235 | 3237 | | |
3236 | 3238 | | |
3237 | 3239 | | |
| 3240 | + | |
| 3241 | + | |
| 3242 | + | |
3238 | 3243 | | |
3239 | 3244 | | |
3240 | 3245 | | |
3241 | | - | |
| 3246 | + | |
3242 | 3247 | | |
3243 | | - | |
| 3248 | + | |
3244 | 3249 | | |
3245 | 3250 | | |
3246 | 3251 | | |
| 3252 | + | |
3247 | 3253 | | |
3248 | 3254 | | |
3249 | 3255 | | |
3250 | | - | |
3251 | | - | |
3252 | | - | |
| 3256 | + | |
| 3257 | + | |
3253 | 3258 | | |
3254 | 3259 | | |
3255 | 3260 | | |
3256 | 3261 | | |
3257 | | - | |
3258 | | - | |
3259 | | - | |
3260 | | - | |
3261 | | - | |
3262 | | - | |
3263 | | - | |
3264 | | - | |
3265 | 3262 | | |
3266 | | - | |
3267 | | - | |
3268 | | - | |
| 3263 | + | |
| 3264 | + | |
3269 | 3265 | | |
3270 | 3266 | | |
3271 | 3267 | | |
3272 | | - | |
3273 | | - | |
| 3268 | + | |
| 3269 | + | |
3274 | 3270 | | |
3275 | | - | |
| 3271 | + | |
3276 | 3272 | | |
3277 | 3273 | | |
3278 | 3274 | | |
3279 | | - | |
3280 | | - | |
3281 | | - | |
3282 | | - | |
3283 | | - | |
3284 | | - | |
3285 | | - | |
3286 | | - | |
3287 | | - | |
3288 | | - | |
3289 | | - | |
3290 | | - | |
| 3275 | + | |
3291 | 3276 | | |
3292 | 3277 | | |
3293 | | - | |
| 3278 | + | |
| 3279 | + | |
3294 | 3280 | | |
3295 | 3281 | | |
3296 | 3282 | | |
3297 | | - | |
3298 | | - | |
3299 | | - | |
3300 | | - | |
| 3283 | + | |
| 3284 | + | |
| 3285 | + | |
3301 | 3286 | | |
3302 | | - | |
| 3287 | + | |
3303 | 3288 | | |
3304 | 3289 | | |
3305 | 3290 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
| |||
292 | 291 | | |
293 | 292 | | |
294 | 293 | | |
| 294 | + | |
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
303 | 304 | | |
304 | 305 | | |
305 | 306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
725 | 725 | | |
726 | 726 | | |
727 | 727 | | |
728 | | - | |
729 | | - | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
730 | 733 | | |
731 | 734 | | |
732 | 735 | | |
| |||
Lines changed: 3 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
163 | | - | |
| 162 | + | |
164 | 163 | | |
165 | 164 | | |
166 | 165 | | |
167 | 166 | | |
168 | 167 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | 168 | | |
183 | 169 | | |
184 | 170 | | |
| |||
0 commit comments