From 6e3bc8a2e82d6fb627315b97f946f4ff2ee367de Mon Sep 17 00:00:00 2001 From: Tianyu Yao Date: Fri, 16 Sep 2022 11:24:03 -0700 Subject: [PATCH] [DevTools] Check if Proxy exists before creating DispatcherProxy (#25278) --- packages/react-debug-tools/src/ReactDebugHooks.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/react-debug-tools/src/ReactDebugHooks.js b/packages/react-debug-tools/src/ReactDebugHooks.js index a09da97f90d72..6409647772eff 100644 --- a/packages/react-debug-tools/src/ReactDebugHooks.js +++ b/packages/react-debug-tools/src/ReactDebugHooks.js @@ -367,7 +367,11 @@ const DispatcherProxyHandler = { }, }; -const DispatcherProxy = new Proxy(Dispatcher, DispatcherProxyHandler); +// `Proxy` may not exist on some platforms +const DispatcherProxy = + typeof Proxy === 'undefined' + ? Dispatcher + : new Proxy(Dispatcher, DispatcherProxyHandler); // Inspect