From 0f29a5b391ee7d30986ce2b97bd44790337285c5 Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Mon, 6 Feb 2023 13:57:38 -0500 Subject: [PATCH] Disable AsyncLocalStorage check in browser builds --- packages/react-server/src/ReactServerStreamConfigBrowser.js | 6 ++---- packages/react/src/__tests__/ReactFetch-test.js | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/react-server/src/ReactServerStreamConfigBrowser.js b/packages/react-server/src/ReactServerStreamConfigBrowser.js index 22ac22f85d569..443b5e7866bbe 100644 --- a/packages/react-server/src/ReactServerStreamConfigBrowser.js +++ b/packages/react-server/src/ReactServerStreamConfigBrowser.js @@ -21,11 +21,9 @@ export function flushBuffered(destination: Destination) { // transform streams. https://github.com/whatwg/streams/issues/960 } -// For now we support AsyncLocalStorage as a global for the "browser" builds -// TODO: Move this to some special WinterCG build. -export const supportsRequestStorage = typeof AsyncLocalStorage === 'function'; +export const supportsRequestStorage = false; export const requestStorage: AsyncLocalStorage> = - supportsRequestStorage ? new AsyncLocalStorage() : (null: any); + (null: any); const VIEW_SIZE = 512; let currentView = null; diff --git a/packages/react/src/__tests__/ReactFetch-test.js b/packages/react/src/__tests__/ReactFetch-test.js index 00f274d5c0da1..753cb03324991 100644 --- a/packages/react/src/__tests__/ReactFetch-test.js +++ b/packages/react/src/__tests__/ReactFetch-test.js @@ -17,8 +17,6 @@ global.TextDecoder = require('util').TextDecoder; global.Headers = require('node-fetch').Headers; global.Request = require('node-fetch').Request; global.Response = require('node-fetch').Response; -// Patch for Browser environments to be able to polyfill AsyncLocalStorage -global.AsyncLocalStorage = require('async_hooks').AsyncLocalStorage; let fetchCount = 0; async function fetchMock(resource, options) {