From cf485e6f6b4d6a6e2ccfe7a12537941925316e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Markb=C3=A5ge?= Date: Thu, 18 Mar 2021 12:46:15 -0400 Subject: [PATCH] [Fizz] Expose a method to abort a pending request (#21027) * Track all suspended work while it's still pending This allows us to abort work and put everything into client rendered mode if we don't want to wait for further I/O. It also allows us to cancel fallbacks if we complete the main content before the fallback. * Expose abort API to the browser streams Since this API already returns a value, we need to use destructuring to expose more options. * Add a test including the client actually client rendering it * Use AbortSignal option for W3C streams instead of external control * Clean up listener after it's used once --- fixtures/fizz-ssr-browser/index.html | 5 +- package.json | 1 + .../src/__tests__/ReactDOMFizzServer-test.js | 51 +++++++ .../ReactDOMFizzServerBrowser-test.js | 19 +++ .../__tests__/ReactDOMFizzServerNode-test.js | 50 +++++++ .../src/server/ReactDOMFizzServerBrowser.js | 18 ++- .../src/server/ReactDOMFizzServerNode.js | 14 +- .../src/ReactNoopServer.js | 3 + packages/react-server/src/ReactFizzServer.js | 133 +++++++++++++++--- 9 files changed, 275 insertions(+), 19 deletions(-) diff --git a/fixtures/fizz-ssr-browser/index.html b/fixtures/fizz-ssr-browser/index.html index 75d3f87b57abb..fa79435067459 100644 --- a/fixtures/fizz-ssr-browser/index.html +++ b/fixtures/fizz-ssr-browser/index.html @@ -20,7 +20,10 @@

Fizz Example