diff --git a/fixtures/flight-browser/index.html b/fixtures/flight-browser/index.html index f8d93ae07872c..0ffa3b7e16597 100644 --- a/fixtures/flight-browser/index.html +++ b/fixtures/flight-browser/index.html @@ -73,12 +73,6 @@

Flight Example

let data = ReactServerDOMClient.createFromFetch( fetch(url) ); - // The client also supports XHR streaming. - // var xhr = new XMLHttpRequest(); - // xhr.open('GET', url); - // let data = ReactServerDOMClient.createFromXHR(xhr); - // xhr.send(); - renderResult(data); } diff --git a/packages/react-server-dom-webpack/src/ReactFlightDOMClientBrowser.js b/packages/react-server-dom-webpack/src/ReactFlightDOMClientBrowser.js index 0b72d58c606cc..d91e7d7a755cb 100644 --- a/packages/react-server-dom-webpack/src/ReactFlightDOMClientBrowser.js +++ b/packages/react-server-dom-webpack/src/ReactFlightDOMClientBrowser.js @@ -17,7 +17,6 @@ import { createResponse, getRoot, reportGlobalError, - processStringChunk, processBinaryChunk, close, } from 'react-client/src/ReactFlightClient'; @@ -92,32 +91,6 @@ function createFromFetch( return getRoot(response); } -function createFromXHR( - request: XMLHttpRequest, - options?: Options, -): Thenable { - const response: FlightResponse = createResponseFromOptions(options); - let processedLength = 0; - function progress(e: ProgressEvent): void { - const chunk = request.responseText; - processStringChunk(response, chunk, processedLength); - processedLength = chunk.length; - } - function load(e: ProgressEvent): void { - progress(e); - close(response); - } - function error(e: ProgressEvent): void { - reportGlobalError(response, new TypeError('Network error')); - } - request.addEventListener('progress', progress); - request.addEventListener('load', load); - request.addEventListener('error', error); - request.addEventListener('abort', error); - request.addEventListener('timeout', error); - return getRoot(response); -} - function encodeReply( value: ReactServerValue, ): Promise< @@ -129,7 +102,6 @@ function encodeReply( } export { - createFromXHR, createFromFetch, createFromReadableStream, encodeReply,