Repository navigation
Commit 0600009
perf(fetchium): hydrate synchronously from a sync store (#69)
* perf(fetchium): hydrate synchronously from a sync store and start the first fetch on a microtask
A query activated against SyncQueryStore (MMKV on mobile) resolved with its
cached value a microtask after activation, so the first React render showed a
loading state and a second, sync-lane render showed the data. The first fetch
then waited on setTimeout(0).
Apply the cached value in the activating read when the store returns
synchronously, and run the subscription and first fetch on a microtask, still
outside the relay's computation. AsyncQueryStore keeps its async path.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(fetchium): rewrite this change's changesets for React developers
Lead with what changes for an app using useQuery or fetchQuery, keep
migration notes to a line or two, and drop internal detail. No source
change.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(fetchium): fetch an invalidated query whatever its staleTime
invalidateQueries() sets updatedAt to 0, but isStale only treated undefined
as stale, so with staleTime: Infinity an uncached query invalidated before
its first fetch started made no request and stayed pending. An invalidation
made before the cache loaded is also kept now, instead of being overwritten
by the cached timestamp.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(fetchium): tighten comments
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(fetchium): cut and shorten comments
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(fetchium): cancel a queued debounce when starting a fetch immediately
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>1 parent 5c636ff commit 0600009
5 files changed
Lines changed: 513 additions & 45 deletions
File tree
- .changeset
- packages/fetchium/src
- __tests__
- react/__tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
24 | 29 | | |
25 | 30 | | |
26 | 31 | | |
| |||
252 | 257 | | |
253 | 258 | | |
254 | 259 | | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
| 260 | + | |
| 261 | + | |
259 | 262 | | |
260 | 263 | | |
261 | | - | |
| 264 | + | |
262 | 265 | | |
263 | 266 | | |
264 | | - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
265 | 272 | | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
270 | 304 | | |
271 | | - | |
272 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
273 | 308 | | |
| 309 | + | |
274 | 310 | | |
275 | | - | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
276 | 314 | | |
277 | 315 | | |
278 | 316 | | |
| |||
282 | 320 | | |
283 | 321 | | |
284 | 322 | | |
285 | | - | |
286 | | - | |
287 | | - | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
288 | 326 | | |
289 | 327 | | |
290 | 328 | | |
291 | | - | |
| 329 | + | |
292 | 330 | | |
293 | 331 | | |
294 | 332 | | |
| |||
377 | 415 | | |
378 | 416 | | |
379 | 417 | | |
| 418 | + | |
| 419 | + | |
380 | 420 | | |
381 | 421 | | |
382 | 422 | | |
| |||
491 | 531 | | |
492 | 532 | | |
493 | 533 | | |
494 | | - | |
| 534 | + | |
| 535 | + | |
495 | 536 | | |
496 | 537 | | |
497 | 538 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
| 233 | + | |
234 | 234 | | |
235 | | - | |
236 | | - | |
| 235 | + | |
237 | 236 | | |
| 237 | + | |
238 | 238 | | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
244 | 242 | | |
245 | | - | |
246 | 243 | | |
247 | 244 | | |
248 | 245 | | |
| |||
277 | 274 | | |
278 | 275 | | |
279 | 276 | | |
280 | | - | |
281 | 277 | | |
282 | | - | |
283 | | - | |
| 278 | + | |
284 | 279 | | |
| 280 | + | |
285 | 281 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
| 282 | + | |
| 283 | + | |
291 | 284 | | |
292 | | - | |
293 | 285 | | |
294 | 286 | | |
295 | 287 | | |
| |||
380 | 372 | | |
381 | 373 | | |
382 | 374 | | |
383 | | - | |
384 | 375 | | |
385 | | - | |
386 | | - | |
| 376 | + | |
387 | 377 | | |
388 | | - | |
389 | 378 | | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | 379 | | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
394 | 383 | | |
395 | | - | |
396 | 384 | | |
397 | 385 | | |
398 | 386 | | |
| |||
0 commit comments