Commit 09228e0
fix(react-db): handle rejected/stale setWindow promises in useLiveInfiniteQuery (#1269)
* fix(react-db): handle rejected/stale setWindow promises in useLiveInfiniteQuery
Three issues in the useEffect that calls setWindow():
1. No .catch() — if setWindow rejects, isFetchingNextPage stays true
forever with no error surfaced.
2. No cleanup — if the effect re-runs while a previous promise is
pending, the stale .then() can set isFetchingNextPage=false
prematurely while new loading is in progress.
3. Unhandled promise rejection — the promise has no rejection handler,
causing an unhandled rejection warning.
Add .catch() with error logging, a cancelled flag with useEffect
cleanup to ignore stale promise settlements.
Fixes #1240
* add changeset
* ci: apply automated fixes
* refactor: use finally block for setIsFetchingNextPage
* ci: apply automated fixes
---------
Co-authored-by: Dmitrii Troitskii <jsleitor@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>1 parent 60620b9 commit 09228e0
File tree
2 files changed
+18
-3
lines changed- .changeset
- packages/react-db/src
2 files changed
+18
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
249 | 250 | | |
250 | 251 | | |
251 | 252 | | |
252 | 253 | | |
253 | 254 | | |
254 | 255 | | |
255 | 256 | | |
256 | | - | |
257 | | - | |
258 | | - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
259 | 265 | | |
260 | 266 | | |
261 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
262 | 272 | | |
263 | 273 | | |
264 | 274 | | |
| |||
0 commit comments