|
2 | 2 | 'fetchium': major |
3 | 3 | --- |
4 | 4 |
|
5 | | -Upgrade notes: behavior an app can observe without using any new API. Each change has its own entry. |
| 5 | +Breaking changes. Most apps need no code changes, but tests that depend on loading frames, render counts or timers may. |
6 | 6 |
|
7 | | -Rendering |
8 | | - |
9 | | -- With `SyncQueryStore`, a cached query renders its data on the first render, with no loading frame. Tests that wait for a loading state or count renders may need updating. |
10 | | -- A refetch, poll or streamed update with identical data does not re-render. `isPending` and `isFetching` still change. |
11 | | -- `t.record` and `t.result` fields apply updates; a record field used to keep its old value. |
12 | | -- List snapshots keep each row's identity when the list is inserted into or re-sorted. |
13 | | -- A nested `t.object` or `t.record` value, or a live collection's value, is a new object after an update changes it, and keeps its identity otherwise. |
14 | | -- Development builds freeze query results, so mutating one throws a `TypeError`. Treat production results as read-only too. |
15 | | - |
16 | | -Fetching |
17 | | - |
18 | | -- The first fetch, and a refetch without `debounce`, start on a microtask instead of after `setTimeout(0)`. |
19 | | -- On resume, a subscription is restored before the request is sent, so a socket that replays a cached value no longer overwrites the fresh response. |
20 | | -- Changing a Signal param mid-fetch aborts that fetch and fetches the new params. A late response for the old params is dropped. |
21 | | -- A query unmounted mid-fetch refetches as soon as it mounts again, without showing the `AbortError`. |
22 | | -- `retry: {}` and `retry: { retryDelay }` retry like `retry: true`. A `shouldRetry` hook can stop retrying permanent errors. |
23 | | -- `shouldRetry`, `reactivationGraceMs`, `reactivationStaggerMs`, `activity` and `pollResumeJitterMs` are reserved `QueryClientConfig` names. Other keys still reach queries as `this.context`. |
24 | | -- `QueryClient.destroy()` aborts every fetch in flight (whoever awaits one gets an `AbortError`), and nothing is written to the store after it. |
25 | | - |
26 | | -Cache and store |
27 | | - |
28 | | -- A cached entry that can't be applied is treated as a miss and fetched, even within `staleTime`. |
29 | | -- A query whose result is not an entity caches each params key separately. Caches from earlier versions are corrected as each key is fetched again. |
30 | | -- Streamed events persist the entities they change. |
31 | | -- `QueryStore` gains optional `mergeEntity`, `onDelete`, `onPersisted`, `isSettled`, `hasQueuedDeletes` and `hasEntity`. A custom store without them writes as before. A store write that throws is retried. |
32 | | -- `AsyncQueryStore` honors `cache.maxCount`, and both built-in stores resize their LRU queue when it changes. |
| 7 | +- **Results are frozen in development.** Mutating query data throws a `TypeError`; copy it first (`[...data.items].sort()`). |
| 8 | +- **Cached data shows on the first render** with `SyncQueryStore`. Update tests that wait for a loading state or count renders. |
| 9 | +- **Fetches start sooner.** The first fetch and refetches without `debounce` start on a microtask, not after `setTimeout(0)`; update tests that advance timers to see them. |
| 10 | +- **Identical data doesn't re-render.** A refetch, poll or streamed update with the same data skips the render; read `isFetching` instead of counting renders. |
| 11 | +- **Nested values change identity only when they change.** `t.object`, `t.record` and live-collection values are new objects after a change, so memoized children re-render; drop workarounds that forced it. |
| 12 | +- **`t.record` and `t.result` fields apply updates** instead of keeping their old value. |
| 13 | +- **Changing a Signal param mid-fetch aborts that fetch** and fetches the new params; the old response is dropped. |
| 14 | +- **`QueryClient.destroy()` aborts fetches in flight.** Code that awaits a query during teardown gets an `AbortError`; catch it. |
| 15 | +- **Awaiting a query can wait for a remount.** If the last component using a query unmounts before its first data arrives, `await fetchQuery(...)` waits for the next mount, `gcTime` collection or `destroy()` instead of rejecting with an `AbortError`. |
| 16 | +- **New reserved `QueryClientConfig` names:** `shouldRetry`, `reactivationGraceMs`, `reactivationStaggerMs`, `activity` and `pollResumeJitterMs` are read as options; rename custom context values that use them. |
| 17 | +- **`retry: {}` and `retry: { retryDelay }` now retry** like `retry: true`; use `retry: false` for no retries. |
| 18 | +- **`AsyncQueryStore` honors `cache.maxCount`.** Check the value if you set one. |
| 19 | +- **Custom `QueryStore`s** get new optional methods (`mergeEntity`, `onDelete`, `onPersisted`, `isSettled`, `hasQueuedDeletes`, `hasEntity`); without them nothing changes. |
0 commit comments