@@ -1239,43 +1239,42 @@ function serializeTypedArray(
12391239}
12401240
12411241function serializeBlob ( request : Request , blob : Blob ) : string {
1242- const id = request . nextChunkId ++ ;
1243- request . pendingChunks ++ ;
1242+ const model : Array < string | Uint8Array > = [ blob . type ] ;
1243+ const newTask = createTask (
1244+ request ,
1245+ model ,
1246+ null ,
1247+ false ,
1248+ request . abortableTasks ,
1249+ ) ;
12441250
12451251 const reader = blob . stream ( ) . getReader ( ) ;
12461252
1247- const model : Array < string | Uint8Array > = [ blob . type ] ;
1248-
12491253 function progress (
12501254 entry : { done : false , value : Uint8Array } | { done : true , value : void } ,
12511255 ) : Promise < void > | void {
12521256 if ( entry . done ) {
1253- const blobId = outlineModel ( request , model ) ;
1254- const blobReference = '$B' + blobId . toString ( 16 ) ;
1255- const processedChunk = encodeReferenceChunk ( request , id , blobReference ) ;
1256- request . completedRegularChunks . push ( processedChunk ) ;
1257- if ( request . destination !== null ) {
1258- flushCompletedChunks ( request , request . destination ) ;
1259- }
1257+ pingTask ( request , newTask ) ;
12601258 return ;
12611259 }
1262- // TODO: Emit the chunk early and refer to it later.
1260+ // TODO: Emit the chunk early and refer to it later by dedupe .
12631261 model . push ( entry . value ) ;
12641262 // $FlowFixMe[incompatible-call]
12651263 return reader . read ( ) . then ( progress ) . catch ( error ) ;
12661264 }
12671265
12681266 function error ( reason : mixed ) {
12691267 const digest = logRecoverableError ( request , reason ) ;
1270- emitErrorChunk ( request , id , digest , reason ) ;
1268+ emitErrorChunk ( request , newTask . id , digest , reason ) ;
1269+ request . abortableTasks . delete ( newTask ) ;
12711270 if ( request . destination !== null ) {
12721271 flushCompletedChunks ( request , request . destination ) ;
12731272 }
12741273 }
12751274 // $FlowFixMe[incompatible-call]
12761275 reader . read ( ) . then ( progress ) . catch ( error ) ;
12771276
1278- return '$' + id . toString ( 16 ) ;
1277+ return '$B ' + newTask . id . toString ( 16 ) ;
12791278}
12801279
12811280function escapeStringValue ( value : string ) : string {
0 commit comments