Skip to content

Commit beb50dd

Browse files
feat: @asyncapi/react-componet upgraded to v2 together with react (#708)
Co-authored-by: neoandmatrix <[email protected]> Co-authored-by: Lukasz Gornicki <[email protected]>
1 parent 1ea43b3 commit beb50dd

File tree

4 files changed

+1526
-459
lines changed

4 files changed

+1526
-459
lines changed

helpers/all.js

+7
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,12 @@ export function renderSpec(asyncapi, params) {
159159
const config = prepareConfiguration(params);
160160
const stringified = stringifySpec(asyncapi);
161161
const component = <AsyncApiComponent schema={stringified} config={config}/>;
162+
if (typeof global.window === 'undefined' || !global.window.document) {
163+
const { JSDOM } = require('jsdom');
164+
const jsdomInstance = new JSDOM('<!doctype html><html><body></body></html>');
165+
global.window = jsdomInstance.window;
166+
global.document = jsdomInstance.window.document;
167+
}
168+
162169
return ReactDOMServer.renderToString(component);
163170
}

0 commit comments

Comments
 (0)