[ci] format
This commit is contained in:
parent
5986517b4f
commit
ef7ba4507a
2 changed files with 10 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
// Write your component code in this file!
|
// Write your component code in this file!
|
||||||
export interface Props {
|
export interface Props {
|
||||||
prefix?: string
|
prefix?: string;
|
||||||
}
|
}
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -140,29 +140,27 @@ async function renderToStaticNodeStreamAsync(vnode) {
|
||||||
* See https://github.com/facebook/react/issues/24169
|
* See https://github.com/facebook/react/issues/24169
|
||||||
*/
|
*/
|
||||||
async function readResult(stream) {
|
async function readResult(stream) {
|
||||||
const reader = stream.getReader();
|
const reader = stream.getReader();
|
||||||
let result = '';
|
let result = '';
|
||||||
const decoder = new TextDecoder('utf-8')
|
const decoder = new TextDecoder('utf-8');
|
||||||
while (true) {
|
while (true) {
|
||||||
const { done, value } = await reader.read();
|
const { done, value } = await reader.read();
|
||||||
if (done) {
|
if (done) {
|
||||||
if(value) {
|
if (value) {
|
||||||
result += decoder.decode(value);
|
result += decoder.decode(value);
|
||||||
} else {
|
} else {
|
||||||
// This closes the decoder
|
// This closes the decoder
|
||||||
decoder.decode(new Uint8Array());
|
decoder.decode(new Uint8Array());
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result += decoder.decode(value, { stream: true });
|
result += decoder.decode(value, { stream: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function renderToReadableStreamAsync(vnode) {
|
async function renderToReadableStreamAsync(vnode) {
|
||||||
return await readResult(
|
return await readResult(await ReactDOM.renderToReadableStream(vnode));
|
||||||
await ReactDOM.renderToReadableStream(vnode),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
Loading…
Add table
Reference in a new issue