Commit 998a583
fix(select): avoid going into infinite loop under certain conditions (#2955)
* fix(select): avoid going into infinite loop under certain conditions
Currently `md-select` calls `writeValue` recursively until the `QueryList` with all of the options is initialized. This usually means 1-2 iterations max, however in certain conditions (e.g. a sibling component throws an error on init) this may not happen and the browser would get thrown into an infinite loop.
This change switches to saving the attempted value assignments in a property and applying it after initialization.
Fixes #2950.
* fix: more elegant approach to initial value and add unit test
* fix: button not being removed after test
* chore: remove unnecessary expression1 parent 93937e6 commit 998a583
3 files changed
+50
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
| 384 | + | |
| 385 | + | |
384 | 386 | | |
385 | 387 | | |
386 | 388 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| |||
1239 | 1242 | | |
1240 | 1243 | | |
1241 | 1244 | | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
1242 | 1253 | | |
1243 | 1254 | | |
1244 | 1255 | | |
| |||
1281 | 1292 | | |
1282 | 1293 | | |
1283 | 1294 | | |
1284 | | - | |
| 1295 | + | |
1285 | 1296 | | |
1286 | 1297 | | |
1287 | 1298 | | |
| |||
1474 | 1485 | | |
1475 | 1486 | | |
1476 | 1487 | | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
1477 | 1509 | | |
1478 | 1510 | | |
1479 | 1511 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
243 | 245 | | |
244 | 246 | | |
245 | 247 | | |
246 | | - | |
247 | | - | |
| 248 | + | |
| 249 | + | |
248 | 250 | | |
249 | 251 | | |
250 | 252 | | |
| |||
257 | 259 | | |
258 | 260 | | |
259 | 261 | | |
260 | | - | |
261 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
262 | 270 | | |
263 | 271 | | |
264 | 272 | | |
| |||
292 | 300 | | |
293 | 301 | | |
294 | 302 | | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
302 | 306 | | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | 307 | | |
307 | 308 | | |
308 | 309 | | |
| |||
0 commit comments