Repository navigation
Commit e6fbed9
committed
fix(compiler): detect resource leaks through conditional platform targets and wrapped host refs
platformTarget now walks ConditionalExpression and LogicalExpression via
someResult, so `const target = enabled ? window : document` is recognized
as a platform EventTarget and its addEventListener is tracked for cleanup.
classify now handles ConditionalExpression/LogicalExpression wrappers in
ref attributes (`ref={enabled ? element : null}`) and walks through
transparent TS wrappers between an ArrayExpression and its
JSXExpressionContainer (`ref={[element] as const}`), so the ref is
correctly marked as a host ref and listeners on its .current are tracked.1 parent cff777a commit e6fbed9
2 files changed
Lines changed: 78 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
895 | 895 | | |
896 | 896 | | |
897 | 897 | | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
898 | 901 | | |
899 | 902 | | |
900 | 903 | | |
| |||
1201 | 1204 | | |
1202 | 1205 | | |
1203 | 1206 | | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
1204 | 1229 | | |
1205 | 1230 | | |
1206 | 1231 | | |
| |||
1216 | 1241 | | |
1217 | 1242 | | |
1218 | 1243 | | |
1219 | | - | |
1220 | | - | |
1221 | | - | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
1222 | 1252 | | |
1223 | 1253 | | |
1224 | 1254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1476 | 1476 | | |
1477 | 1477 | | |
1478 | 1478 | | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
1479 | 1494 | | |
1480 | 1495 | | |
1481 | 1496 | | |
| |||
1750 | 1765 | | |
1751 | 1766 | | |
1752 | 1767 | | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
1753 | 1776 | | |
1754 | 1777 | | |
1755 | 1778 | | |
| |||
1766 | 1789 | | |
1767 | 1790 | | |
1768 | 1791 | | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
1769 | 1810 | | |
1770 | 1811 | | |
1771 | 1812 | | |
| |||
1949 | 1990 | | |
1950 | 1991 | | |
1951 | 1992 | | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
1952 | 1997 | | |
1953 | 1998 | | |
1954 | 1999 | | |
| |||
0 commit comments