MCPcopy
hub / github.com/facebook/react / App

Function App

packages/react-dom/src/__tests__/ReactDOMFizzStaticBrowser-test.js:416–452  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

414 const errors = [];
415 const controller = new AbortController();
416 function App() {
417 controller.abort();
418 return (
419 <Suspense fallback={<div>Loading</div>}>
420 <InfiniteSuspend />
421 </Suspense>
422 );
423 }
424 const streamPromise = serverAct(() =>
425 ReactDOMFizzStatic.prerender(
426 <div>
427 <App />
428 </div>,
429 {
430 signal: controller.signal,
431 onError(x) {
432 errors.push(x.message);
433 },
434 },
435 ),
436 );
437
438 if (gate(flags => flags.enableHalt)) {
439 const {prelude} = await streamPromise;
440 const content = await readContent(prelude);
441 expect(errors).toEqual(['This operation was aborted']);
442 expect(content).toBe('');
443 } else {
444 let caughtError = null;
445 try {
446 await streamPromise;
447 } catch (error) {
448 caughtError = error;
449 }
450 expect(caughtError.message).toBe('This operation was aborted');
451 expect(errors).toEqual(['This operation was aborted']);
452 }
453 });
454
455 // @gate !enableHalt

Callers

nothing calls this directly

Calls 4

serverActFunction · 0.70
abortMethod · 0.65
toBeMethod · 0.65
toEqualMethod · 0.65

Tested by

no test coverage detected