@@ -368,7 +368,15 @@ async function fetchFeed(
368
368
} = options
369
369
370
370
const controller = new AbortController ( )
371
- const timeoutId = setTimeout ( ( ) => controller . abort ( ) , timeout )
371
+ let timeoutId : NodeJS . Timeout | null = null
372
+
373
+ // Only set timeout if we're not in a test environment with fake timers
374
+ if (
375
+ typeof ( globalThis as any ) . vi === `undefined` ||
376
+ ! ( globalThis as any ) . vi ?. isFakeTimers ?.( )
377
+ ) {
378
+ timeoutId = setTimeout ( ( ) => controller . abort ( ) , timeout )
379
+ }
372
380
373
381
try {
374
382
const response = await fetch ( url , {
@@ -391,7 +399,9 @@ async function fetchFeed(
391
399
}
392
400
throw error instanceof FeedFetchError ? error : new FeedFetchError ( url )
393
401
} finally {
394
- clearTimeout ( timeoutId )
402
+ if ( timeoutId ) {
403
+ clearTimeout ( timeoutId )
404
+ }
395
405
}
396
406
}
397
407
@@ -511,7 +521,6 @@ function createFeedCollectionOptions<
511
521
value : any
512
522
} ) => void
513
523
commit : ( ) => void
514
- markReady : ( ) => void
515
524
} ) => {
516
525
try {
517
526
debug ( `Fetching feed from ${ feedUrl } ` )
@@ -610,7 +619,11 @@ function createFeedCollectionOptions<
610
619
// Polling function
611
620
const poll = async ( ) => {
612
621
try {
613
- await refreshFeed ( syncParams ! )
622
+ await refreshFeed ( {
623
+ begin : syncParams ! . begin ,
624
+ write : syncParams ! . write ,
625
+ commit : syncParams ! . commit ,
626
+ } )
614
627
} catch ( error ) {
615
628
debug ( `Polling error: ${ error } ` )
616
629
// Continue polling despite errors
@@ -623,7 +636,11 @@ function createFeedCollectionOptions<
623
636
}
624
637
625
638
// Initial feed fetch (sync)
626
- refreshFeed ( params )
639
+ refreshFeed ( {
640
+ begin : params . begin ,
641
+ write : params . write ,
642
+ commit : params . commit ,
643
+ } )
627
644
. then ( ( ) => {
628
645
markReady ( )
629
646
@@ -656,12 +673,15 @@ function createFeedCollectionOptions<
656
673
begin : ( ) => { } ,
657
674
write : ( ) => { } ,
658
675
commit : ( ) => { } ,
659
- markReady : ( ) => { } ,
660
676
}
661
677
await refreshFeed ( dummyParams )
662
678
return
663
679
}
664
- await refreshFeed ( syncParams )
680
+ await refreshFeed ( {
681
+ begin : syncParams . begin ,
682
+ write : syncParams . write ,
683
+ commit : syncParams . commit ,
684
+ } )
665
685
} ,
666
686
clearSeenItems : ( ) => {
667
687
seenItems = new Map ( )
0 commit comments