Skip to content

Commit

Permalink
add temp test
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Oct 7, 2024
1 parent f171f19 commit 404b455
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/docusaurus/src/client/renderToHtml.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
import type {ReactNode} from 'react';
// @ts-expect-error: see https://github.com/facebook/react/issues/31134
import {renderToReadableStream as renderToReadableStreamImpl} from 'react-dom/server.browser';
import type {renderToReadableStream as renderToReadableStreamType} from 'react-dom/server';
import {
renderToString,
type renderToReadableStream as renderToReadableStreamType,
} from 'react-dom/server';
import {text} from 'stream/consumers';

const renderToReadableStream: typeof renderToReadableStreamType =
Expand All @@ -21,7 +24,13 @@ export async function renderToHtml(app: ReactNode): Promise<string> {
}).then(async (stream) => {
await stream.allReady;
// @ts-expect-error: it works fine
const html = text(stream);
const html = await text(stream);

// TODO remove this test
if (html !== renderToString(app)) {
throw new Error('Bad');
}

resolve(html);
}, reject);
});
Expand Down

0 comments on commit 404b455

Please sign in to comment.