Commit c0fc916
authored
fix(core): do not refetch disabled queries (#3223)
* fix(core): do not refetch disabled queries
with refetchQueries or invalidateQueries + refetchType "inactive"
disabled queries (=queries that have observers which are all enabled:false) are matched as "inactive"; this is okay when searching for them via findAll or for removeQueries, but the docs clearly state that refetchQueries / invalidateQueries do not refetch disabled queries, and that the only way to refetch them is via refetch returned from useQuery; this is important when using enabled to signal that some dependencies are not yet ready
some tests needed to be adapted because we used disabled observer + refetchQueries a lot. The easiest way to emulate the observers we wanted here was mostly with initialData + staleTime, and to get a real inactive query, we just need to subscribe + unsubscribe immediately
* fix(core): do not refetch disabled queries
add tests for refetchQueries + disabled
* fix(core): do not refetch disabled queries
update test to make more sense - title said disabled queries, but we had no disabled query; test now does the opposite of what it did before, but that's what this PR does :)1 parent d4b6afc commit c0fc916
File tree
5 files changed
+83
-57
lines changed- src
- core
- tests
- devtools
- reactjs/tests
5 files changed
+83
-57
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
253 | 257 | | |
254 | 258 | | |
255 | 259 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
293 | 296 | | |
294 | 297 | | |
295 | 298 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
707 | 707 | | |
708 | 708 | | |
709 | 709 | | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
710 | 745 | | |
711 | 746 | | |
712 | 747 | | |
| |||
716 | 751 | | |
717 | 752 | | |
718 | 753 | | |
719 | | - | |
| 754 | + | |
| 755 | + | |
720 | 756 | | |
721 | 757 | | |
722 | 758 | | |
723 | | - | |
| 759 | + | |
| 760 | + | |
724 | 761 | | |
725 | 762 | | |
726 | 763 | | |
| |||
964 | 1001 | | |
965 | 1002 | | |
966 | 1003 | | |
967 | | - | |
| 1004 | + | |
968 | 1005 | | |
969 | 1006 | | |
970 | | - | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
971 | 1010 | | |
972 | 1011 | | |
973 | | - | |
974 | 1012 | | |
975 | 1013 | | |
976 | 1014 | | |
| |||
1002 | 1040 | | |
1003 | 1041 | | |
1004 | 1042 | | |
1005 | | - | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
1006 | 1052 | | |
1007 | 1053 | | |
1008 | 1054 | | |
1009 | 1055 | | |
1010 | | - | |
1011 | | - | |
1012 | | - | |
1013 | | - | |
1014 | | - | |
1015 | | - | |
1016 | | - | |
1017 | | - | |
1018 | | - | |
1019 | | - | |
1020 | | - | |
1021 | | - | |
1022 | 1056 | | |
1023 | 1057 | | |
1024 | 1058 | | |
| |||
1033 | 1067 | | |
1034 | 1068 | | |
1035 | 1069 | | |
1036 | | - | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
1037 | 1079 | | |
1038 | 1080 | | |
1039 | 1081 | | |
1040 | 1082 | | |
1041 | | - | |
1042 | | - | |
1043 | | - | |
1044 | | - | |
1045 | | - | |
1046 | | - | |
1047 | | - | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
1051 | | - | |
1052 | | - | |
1053 | 1083 | | |
1054 | 1084 | | |
1055 | 1085 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
703 | 703 | | |
704 | 704 | | |
705 | 705 | | |
706 | | - | |
707 | | - | |
708 | 706 | | |
709 | 707 | | |
710 | 708 | | |
| |||
747 | 745 | | |
748 | 746 | | |
749 | 747 | | |
750 | | - | |
| 748 | + | |
751 | 749 | | |
752 | 750 | | |
753 | 751 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1180 | 1180 | | |
1181 | 1181 | | |
1182 | 1182 | | |
1183 | | - | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
1184 | 1187 | | |
1185 | 1188 | | |
1186 | 1189 | | |
| |||
1266 | 1269 | | |
1267 | 1270 | | |
1268 | 1271 | | |
1269 | | - | |
| 1272 | + | |
1270 | 1273 | | |
1271 | 1274 | | |
1272 | 1275 | | |
| |||
1295 | 1298 | | |
1296 | 1299 | | |
1297 | 1300 | | |
1298 | | - | |
| 1301 | + | |
1299 | 1302 | | |
1300 | | - | |
| 1303 | + | |
1301 | 1304 | | |
1302 | 1305 | | |
1303 | 1306 | | |
1304 | 1307 | | |
1305 | 1308 | | |
1306 | 1309 | | |
1307 | | - | |
1308 | | - | |
1309 | | - | |
1310 | | - | |
1311 | | - | |
1312 | | - | |
1313 | | - | |
1314 | | - | |
1315 | | - | |
1316 | | - | |
1317 | | - | |
1318 | | - | |
1319 | 1310 | | |
1320 | 1311 | | |
1321 | 1312 | | |
| |||
0 commit comments