Commit 27e72de
authored
fix(useQuery): cleanup queries even if they have been fetching (#2950)
* fix(useQuery): cleanup queries even if they have been fetching
* fix(useQuery): cleanup queries even if they have been fetching
do not re-schedule garbage collection if a query is fetching and we never had any observers subscribed; this is necessary to make suspense work, because with suspense, we always throw before we subscribe, so the garbage collection would prematurely remove the query, resulting in an infinite loop
* fix(useQuery): cleanup queries even if they have been fetching
only schedule garbage collection when the last observer unsubscribes rather than in the constructor
this works around the suspense issue because we only add observers after we've loaded as we throw before that.1 parent ebd22b2 commit 27e72de
2 files changed
+29
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
179 | 178 | | |
180 | 179 | | |
181 | 180 | | |
| |||
214 | 213 | | |
215 | 214 | | |
216 | 215 | | |
217 | | - | |
218 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
219 | 222 | | |
220 | 223 | | |
221 | 224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
544 | 544 | | |
545 | 545 | | |
546 | 546 | | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
547 | 570 | | |
548 | 571 | | |
549 | 572 | | |
| |||
0 commit comments