@@ -2239,11 +2239,12 @@ export function makeTable(options) {
22392239 entries = transformToEntries ( entries , select , context , readTxn , null ) ;
22402240 let ordered ;
22412241 // if we are doing post-ordering, we need to get records first, then sort them
2242- results . iterate = function ( ) {
2242+ results . iterate = function ( options : { async : boolean } ) {
22432243 let sortedArrayIterator : IterableIterator < any > ;
2244- const dbIterator = entries [ Symbol . asyncIterator ]
2245- ? entries [ Symbol . asyncIterator ] ( )
2246- : entries [ Symbol . iterator ] ( ) ;
2244+ const dbIterator =
2245+ options ?. async && entries [ Symbol . asyncIterator ]
2246+ ? entries [ Symbol . asyncIterator ] ( )
2247+ : entries [ Symbol . iterator ] ( ) ;
22472248 let dbDone : boolean ;
22482249 const dbOrderedAttribute = sort . dbOrderedAttribute ;
22492250 let enqueuedEntryForNextGroup : any ;
@@ -2357,7 +2358,10 @@ export function makeTable(options) {
23572358 } ;
23582359 applySortingOnSelect ( sort ) ;
23592360 } else {
2360- results . iterate = ( entries [ Symbol . asyncIterator ] || entries [ Symbol . iterator ] ) . bind ( entries ) ;
2361+ results . iterate = ( options : { async : boolean } ) => {
2362+ if ( options ?. async && entries [ Symbol . asyncIterator ] ) return entries [ Symbol . asyncIterator ] ( ) ;
2363+ else return entries [ Symbol . iterator ] ( ) ;
2364+ } ;
23612365 results = results . map ( function ( entry ) {
23622366 try {
23632367 // because this is a part of a stream of results, we will often be continuing to iterate over the results when there are errors,
0 commit comments