MCPcopy
hub / github.com/react/react / serverAct

Function serverAct

packages/react-dom/src/__tests__/ReactDOMFizzSuspenseList-test.js:83–102  ·  view source on GitHub ↗
(callback)

Source from the content-addressed store, hash-verified

81 });
82
83 async function serverAct(callback) {
84 await callback();
85 // Await one turn around the event loop.
86 // This assumes that we'll flush everything we have so far.
87 await new Promise(resolve => {
88 setImmediate(resolve);
89 });
90 if (hasErrored) {
91 throw fatalError;
92 }
93 // JSDOM doesn't support stream HTML parser so we need to give it a proper fragment.
94 // We also want to execute any scripts that are embedded.
95 // We assume that we have now received a proper fragment of HTML.
96 const bufferedContent = buffer;
97 buffer = '';
98 const temp = document.createElement('body');
99 temp.innerHTML = bufferedContent;
100 await insertNodesAndExecuteScripts(temp, container, null);
101 jest.runAllTimers();
102 }
103
104 function Text(props) {
105 Scheduler.log(props.text);

Callers 2

FooFunction · 0.70

Calls 3

runAllTimersMethod · 0.80
callbackFunction · 0.50

Tested by

no test coverage detected