@@ -368,7 +368,15 @@ async function fetchFeed(
368368 } = options
369369
370370 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+ }
372380
373381 try {
374382 const response = await fetch ( url , {
@@ -391,7 +399,9 @@ async function fetchFeed(
391399 }
392400 throw error instanceof FeedFetchError ? error : new FeedFetchError ( url )
393401 } finally {
394- clearTimeout ( timeoutId )
402+ if ( timeoutId ) {
403+ clearTimeout ( timeoutId )
404+ }
395405 }
396406}
397407
@@ -511,7 +521,6 @@ function createFeedCollectionOptions<
511521 value : any
512522 } ) => void
513523 commit : ( ) => void
514- markReady : ( ) => void
515524 } ) => {
516525 try {
517526 debug ( `Fetching feed from ${ feedUrl } ` )
@@ -610,7 +619,11 @@ function createFeedCollectionOptions<
610619 // Polling function
611620 const poll = async ( ) => {
612621 try {
613- await refreshFeed ( syncParams ! )
622+ await refreshFeed ( {
623+ begin : syncParams ! . begin ,
624+ write : syncParams ! . write ,
625+ commit : syncParams ! . commit ,
626+ } )
614627 } catch ( error ) {
615628 debug ( `Polling error: ${ error } ` )
616629 // Continue polling despite errors
@@ -623,7 +636,11 @@ function createFeedCollectionOptions<
623636 }
624637
625638 // Initial feed fetch (sync)
626- refreshFeed ( params )
639+ refreshFeed ( {
640+ begin : params . begin ,
641+ write : params . write ,
642+ commit : params . commit ,
643+ } )
627644 . then ( ( ) => {
628645 markReady ( )
629646
@@ -656,12 +673,15 @@ function createFeedCollectionOptions<
656673 begin : ( ) => { } ,
657674 write : ( ) => { } ,
658675 commit : ( ) => { } ,
659- markReady : ( ) => { } ,
660676 }
661677 await refreshFeed ( dummyParams )
662678 return
663679 }
664- await refreshFeed ( syncParams )
680+ await refreshFeed ( {
681+ begin : syncParams . begin ,
682+ write : syncParams . write ,
683+ commit : syncParams . commit ,
684+ } )
665685 } ,
666686 clearSeenItems : ( ) => {
667687 seenItems = new Map ( )
0 commit comments