diff --git a/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js b/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js index 8967ea68c913f..47c8a0aaa8322 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js @@ -9,7 +9,6 @@ import * as React from 'react'; import {useContext, useMemo, useRef, useState} from 'react'; -import {unstable_batchedUpdates as batchedUpdates} from 'react-dom'; import {copy} from 'clipboard-js'; import { BridgeContext, @@ -178,10 +177,8 @@ function Row({ validAttributes === null || validAttributes.indexOf(newAttribute) >= 0; - batchedUpdates(() => { - setLocalAttribute(newAttribute); - setIsAttributeValid(isValid); - }); + setLocalAttribute(newAttribute); + setIsAttributeValid(isValid); }; // $FlowFixMe[missing-local-annot] @@ -192,10 +189,8 @@ function Row({ isValid = true; } catch (error) {} - batchedUpdates(() => { - setLocalValue(newValue); - setIsValueValid(isValid); - }); + setLocalValue(newValue); + setIsValueValid(isValid); }; const resetAttribute = () => { diff --git a/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/context.js b/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/context.js index 7170864ab35fe..85905666cb33a 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/context.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/context.js @@ -18,7 +18,6 @@ import { useMemo, useState, } from 'react'; -import {unstable_batchedUpdates as batchedUpdates} from 'react-dom'; import {createResource} from 'react-devtools-shared/src/devtools/cache'; import { BridgeContext, @@ -120,10 +119,8 @@ function NativeStyleContextController({children}: Props): React.Node { const request = inProgressRequests.get(element); if (request != null) { inProgressRequests.delete(element); - batchedUpdates(() => { - request.resolveFn(styleAndLayout); - setCurrentStyleAndLayout(styleAndLayout); - }); + request.resolveFn(styleAndLayout); + setCurrentStyleAndLayout(styleAndLayout); } else { resource.write(element, styleAndLayout); diff --git a/packages/react-devtools-shared/src/devtools/views/Profiler/ProfilerContext.js b/packages/react-devtools-shared/src/devtools/views/Profiler/ProfilerContext.js index 38203175136b0..a9225c3c8fef1 100644 --- a/packages/react-devtools-shared/src/devtools/views/Profiler/ProfilerContext.js +++ b/packages/react-devtools-shared/src/devtools/views/Profiler/ProfilerContext.js @@ -11,7 +11,6 @@ import type {ReactContext} from 'shared/ReactTypes'; import * as React from 'react'; import {createContext, useCallback, useContext, useMemo, useState} from 'react'; -import {unstable_batchedUpdates as batchedUpdates} from 'react-dom'; import {useLocalStorage, useSubscription} from '../hooks'; import { TreeDispatcherContext, @@ -166,31 +165,28 @@ function ProfilerContextController({children}: Props): React.Node { ); if (prevProfilingData !== profilingData) { - batchedUpdates(() => { - setPrevProfilingData(profilingData); - - const dataForRoots = - profilingData !== null ? profilingData.dataForRoots : null; - if (dataForRoots != null) { - const firstRootID = dataForRoots.keys().next().value || null; - - if (rootID === null || !dataForRoots.has(rootID)) { - let selectedElementRootID = null; - if (inspectedElementID !== null) { - selectedElementRootID = - store.getRootIDForElement(inspectedElementID); - } - if ( - selectedElementRootID !== null && - dataForRoots.has(selectedElementRootID) - ) { - setRootIDAndClearFiber(selectedElementRootID); - } else { - setRootIDAndClearFiber(firstRootID); - } + setPrevProfilingData(profilingData); + + const dataForRoots = + profilingData !== null ? profilingData.dataForRoots : null; + if (dataForRoots != null) { + const firstRootID = dataForRoots.keys().next().value || null; + + if (rootID === null || !dataForRoots.has(rootID)) { + let selectedElementRootID = null; + if (inspectedElementID !== null) { + selectedElementRootID = store.getRootIDForElement(inspectedElementID); + } + if ( + selectedElementRootID !== null && + dataForRoots.has(selectedElementRootID) + ) { + setRootIDAndClearFiber(selectedElementRootID); + } else { + setRootIDAndClearFiber(firstRootID); } } - }); + } } const [isCommitFilterEnabled, setIsCommitFilterEnabled] = @@ -229,15 +225,13 @@ function ProfilerContextController({children}: Props): React.Node { ); if (isProfiling) { - batchedUpdates(() => { - if (selectedCommitIndex !== null) { - selectCommitIndex(null); - } - if (selectedFiberID !== null) { - selectFiberID(null); - selectFiberName(null); - } - }); + if (selectedCommitIndex !== null) { + selectCommitIndex(null); + } + if (selectedFiberID !== null) { + selectFiberID(null); + selectFiberName(null); + } } const value = useMemo( diff --git a/packages/react-devtools-shared/src/devtools/views/UnsupportedVersionDialog.js b/packages/react-devtools-shared/src/devtools/views/UnsupportedVersionDialog.js index 7f2421893003c..717019df431a1 100644 --- a/packages/react-devtools-shared/src/devtools/views/UnsupportedVersionDialog.js +++ b/packages/react-devtools-shared/src/devtools/views/UnsupportedVersionDialog.js @@ -9,7 +9,6 @@ import * as React from 'react'; import {Fragment, useContext, useEffect, useState} from 'react'; -import {unstable_batchedUpdates as batchedUpdates} from 'react-dom'; import {ModalDialogContext} from './ModalDialog'; import {StoreContext} from './context'; import {UNSUPPORTED_VERSION_URL} from '../constants'; @@ -26,14 +25,12 @@ export default function UnsupportedVersionDialog(_: {}): null { useEffect(() => { if (state === 'dialog-not-shown') { const showDialog = () => { - batchedUpdates(() => { - setState('show-dialog'); - dispatch({ - canBeDismissed: true, - id: 'UnsupportedVersionDialog', - type: 'SHOW', - content: , - }); + setState('show-dialog'); + dispatch({ + canBeDismissed: true, + id: 'UnsupportedVersionDialog', + type: 'SHOW', + content: , }); };