Skip to content

Commit

Permalink
Remove XHR support from Flight
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed May 17, 2023
1 parent d7a98a5 commit ea2a535
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 33 deletions.
6 changes: 0 additions & 6 deletions fixtures/flight-browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ <h1>Flight Example</h1>
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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
createResponse,
getRoot,
reportGlobalError,
processStringChunk,
processBinaryChunk,
close,
} from 'react-client/src/ReactFlightClientStream';
Expand Down Expand Up @@ -92,32 +91,6 @@ function createFromFetch<T>(
return getRoot(response);
}

function createFromXHR<T>(
request: XMLHttpRequest,
options?: Options,
): Thenable<T> {
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<
Expand Down

0 comments on commit ea2a535

Please sign in to comment.