Commit 83a3b85
refactor(core): Do not refresh view if producers did not actually change (#52476)
Producers represent values which can deliver change notifications.
When a producer value is changed, a change notification is propagated through the graph,
notifying live consumers which depend on the producer of the potential update.
Note here that this is a _potential_ update.
A producer may not have actually "changed" based on its equality function. With
this commit, before refreshing a view that is only marked for refresh
because its consumer is dirty, we poll producers for change to see if
they really have. If not, we can skip the refresh. The example test in this commit
shows that a `computed` which depends on a `signal` that is updated but
produces a value that is the same as before will _not_ cause the
component's template to refresh.
fixes #51797
PR Close #524761 parent 164cfc0 commit 83a3b85
File tree
18 files changed
+166
-174
lines changed- goldens/public-api/core/primitives/signals
- packages/core
- src/render3
- instructions
- interfaces
- test
- acceptance
- bundling
- animations-standalone
- animations
- cyclic_import
- defer
- forms_reactive
- forms_template_driven
- hello_world
- hydration
- router
- standalone_bootstrap
- todo
18 files changed
+166
-174
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
Lines changed: 5 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 18 | + | |
22 | 19 | | |
23 | | - | |
24 | 20 | | |
25 | 21 | | |
26 | 22 | | |
| |||
405 | 401 | | |
406 | 402 | | |
407 | 403 | | |
408 | | - | |
409 | | - | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
410 | 407 | | |
411 | 408 | | |
412 | 409 | | |
413 | 410 | | |
414 | 411 | | |
415 | | - | |
| 412 | + | |
416 | 413 | | |
417 | 414 | | |
418 | 415 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
| |||
356 | 355 | | |
357 | 356 | | |
358 | 357 | | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | 358 | | |
365 | 359 | | |
366 | 360 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
375 | 375 | | |
376 | 376 | | |
377 | 377 | | |
378 | | - | |
379 | 378 | | |
380 | 379 | | |
381 | 380 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
Lines changed: 33 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
207 | 239 | | |
208 | 240 | | |
209 | 241 | | |
| |||
778 | 810 | | |
779 | 811 | | |
780 | 812 | | |
781 | | - | |
| 813 | + | |
782 | 814 | | |
783 | 815 | | |
784 | 816 | | |
| |||
Lines changed: 11 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
738 | 738 | | |
739 | 739 | | |
740 | 740 | | |
741 | | - | |
742 | | - | |
743 | | - | |
744 | | - | |
745 | | - | |
746 | | - | |
747 | | - | |
| 741 | + | |
748 | 742 | | |
749 | 743 | | |
750 | | - | |
| 744 | + | |
751 | 745 | | |
752 | 746 | | |
753 | 747 | | |
| |||
794 | 788 | | |
795 | 789 | | |
796 | 790 | | |
797 | | - | |
798 | | - | |
799 | | - | |
800 | 791 | | |
801 | 792 | | |
802 | 793 | | |
| |||
845 | 836 | | |
846 | 837 | | |
847 | 838 | | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
848 | 842 | | |
849 | 843 | | |
850 | 844 | | |
| |||
887 | 881 | | |
888 | 882 | | |
889 | 883 | | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
890 | 887 | | |
891 | 888 | | |
892 | 889 | | |
| |||
1007 | 1004 | | |
1008 | 1005 | | |
1009 | 1006 | | |
1010 | | - | |
1011 | | - | |
1012 | | - | |
1013 | 1007 | | |
1014 | 1008 | | |
1015 | 1009 | | |
| |||
1298 | 1292 | | |
1299 | 1293 | | |
1300 | 1294 | | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
1301 | 1298 | | |
1302 | 1299 | | |
1303 | 1300 | | |
| |||
Lines changed: 11 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
795 | 795 | | |
796 | 796 | | |
797 | 797 | | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | | - | |
803 | | - | |
804 | | - | |
| 798 | + | |
805 | 799 | | |
806 | 800 | | |
807 | | - | |
| 801 | + | |
808 | 802 | | |
809 | 803 | | |
810 | 804 | | |
| |||
857 | 851 | | |
858 | 852 | | |
859 | 853 | | |
860 | | - | |
861 | | - | |
862 | | - | |
863 | 854 | | |
864 | 855 | | |
865 | 856 | | |
| |||
908 | 899 | | |
909 | 900 | | |
910 | 901 | | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
911 | 905 | | |
912 | 906 | | |
913 | 907 | | |
| |||
950 | 944 | | |
951 | 945 | | |
952 | 946 | | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
953 | 950 | | |
954 | 951 | | |
955 | 952 | | |
| |||
1073 | 1070 | | |
1074 | 1071 | | |
1075 | 1072 | | |
1076 | | - | |
1077 | | - | |
1078 | | - | |
1079 | 1073 | | |
1080 | 1074 | | |
1081 | 1075 | | |
| |||
1373 | 1367 | | |
1374 | 1368 | | |
1375 | 1369 | | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
1376 | 1373 | | |
1377 | 1374 | | |
1378 | 1375 | | |
| |||
Lines changed: 11 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
600 | 600 | | |
601 | 601 | | |
602 | 602 | | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
| 603 | + | |
610 | 604 | | |
611 | 605 | | |
612 | | - | |
| 606 | + | |
613 | 607 | | |
614 | 608 | | |
615 | 609 | | |
| |||
641 | 635 | | |
642 | 636 | | |
643 | 637 | | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | 638 | | |
648 | 639 | | |
649 | 640 | | |
| |||
686 | 677 | | |
687 | 678 | | |
688 | 679 | | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
689 | 683 | | |
690 | 684 | | |
691 | 685 | | |
| |||
719 | 713 | | |
720 | 714 | | |
721 | 715 | | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
722 | 719 | | |
723 | 720 | | |
724 | 721 | | |
| |||
836 | 833 | | |
837 | 834 | | |
838 | 835 | | |
839 | | - | |
840 | | - | |
841 | | - | |
842 | 836 | | |
843 | 837 | | |
844 | 838 | | |
| |||
1094 | 1088 | | |
1095 | 1089 | | |
1096 | 1090 | | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
1097 | 1094 | | |
1098 | 1095 | | |
1099 | 1096 | | |
| |||
0 commit comments