Commit c5d42f0
committed
Do not unmount layout effects if ancestor Offscreen is hidden (#25628)
This is a follow up on facebook/react#25592
There is another condition Offscreen calls
`recursivelyTraverseDisappearLayoutEffects` when it shouldn't. Offscreen
may be nested. When nested Offscreen is hidden, it should only unmount
layout effects if it meets following conditions:
1. This is an update, not first mount.
2. This Offscreen was hidden before.
3. No ancestor Offscreen is hidden.
Previously, we were not accounting for the third condition.1 parent 271a127 commit c5d42f0
3 files changed
Lines changed: 46 additions & 14 deletions
File tree
- packages/react-reconciler/src
- __tests__
Lines changed: 10 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2869 | 2869 | | |
2870 | 2870 | | |
2871 | 2871 | | |
2872 | | - | |
2873 | 2872 | | |
2874 | 2873 | | |
2875 | 2874 | | |
| |||
2880 | 2879 | | |
2881 | 2880 | | |
2882 | 2881 | | |
2883 | | - | |
2884 | | - | |
2885 | | - | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
2886 | 2890 | | |
2887 | | - | |
| 2891 | + | |
2888 | 2892 | | |
2889 | 2893 | | |
2890 | 2894 | | |
| |||
2897 | 2901 | | |
2898 | 2902 | | |
2899 | 2903 | | |
2900 | | - | |
| 2904 | + | |
2901 | 2905 | | |
2902 | 2906 | | |
2903 | 2907 | | |
| |||
Lines changed: 10 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2869 | 2869 | | |
2870 | 2870 | | |
2871 | 2871 | | |
2872 | | - | |
2873 | 2872 | | |
2874 | 2873 | | |
2875 | 2874 | | |
| |||
2880 | 2879 | | |
2881 | 2880 | | |
2882 | 2881 | | |
2883 | | - | |
2884 | | - | |
2885 | | - | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
2886 | 2890 | | |
2887 | | - | |
| 2891 | + | |
2888 | 2892 | | |
2889 | 2893 | | |
2890 | 2894 | | |
| |||
2897 | 2901 | | |
2898 | 2902 | | |
2899 | 2903 | | |
2900 | | - | |
| 2904 | + | |
2901 | 2905 | | |
2902 | 2906 | | |
2903 | 2907 | | |
| |||
Lines changed: 26 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
284 | 288 | | |
285 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
286 | 293 | | |
287 | 294 | | |
288 | | - | |
289 | | - | |
| 295 | + | |
| 296 | + | |
290 | 297 | | |
| 298 | + | |
291 | 299 | | |
292 | 300 | | |
293 | 301 | | |
| |||
303 | 311 | | |
304 | 312 | | |
305 | 313 | | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
306 | 329 | | |
| 330 | + | |
307 | 331 | | |
308 | 332 | | |
309 | 333 | | |
| |||
0 commit comments