Skip to content

File tree

4 files changed

+39
-56
lines changed

4 files changed

+39
-56
lines changed

packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import * as React from 'react';
1111
import {useContext, useMemo, useRef, useState} from 'react';
12-
import {unstable_batchedUpdates as batchedUpdates} from 'react-dom';
1312
import {copy} from 'clipboard-js';
1413
import {
1514
BridgeContext,
@@ -178,10 +177,8 @@ function Row({
178177
validAttributes === null ||
179178
validAttributes.indexOf(newAttribute) >= 0;
180179

181-
batchedUpdates(() => {
182-
setLocalAttribute(newAttribute);
183-
setIsAttributeValid(isValid);
184-
});
180+
setLocalAttribute(newAttribute);
181+
setIsAttributeValid(isValid);
185182
};
186183

187184
// $FlowFixMe[missing-local-annot]
@@ -192,10 +189,8 @@ function Row({
192189
isValid = true;
193190
} catch (error) {}
194191

195-
batchedUpdates(() => {
196-
setLocalValue(newValue);
197-
setIsValueValid(isValid);
198-
});
192+
setLocalValue(newValue);
193+
setIsValueValid(isValid);
199194
};
200195

201196
const resetAttribute = () => {

packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/context.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
useMemo,
1919
useState,
2020
} from 'react';
21-
import {unstable_batchedUpdates as batchedUpdates} from 'react-dom';
2221
import {createResource} from 'react-devtools-shared/src/devtools/cache';
2322
import {
2423
BridgeContext,
@@ -120,10 +119,8 @@ function NativeStyleContextController({children}: Props): React.Node {
120119
const request = inProgressRequests.get(element);
121120
if (request != null) {
122121
inProgressRequests.delete(element);
123-
batchedUpdates(() => {
124-
request.resolveFn(styleAndLayout);
125-
setCurrentStyleAndLayout(styleAndLayout);
126-
});
122+
request.resolveFn(styleAndLayout);
123+
setCurrentStyleAndLayout(styleAndLayout);
127124
} else {
128125
resource.write(element, styleAndLayout);
129126

packages/react-devtools-shared/src/devtools/views/Profiler/ProfilerContext.js

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import type {ReactContext} from 'shared/ReactTypes';
1111

1212
import * as React from 'react';
1313
import {createContext, useCallback, useContext, useMemo, useState} from 'react';
14-
import {unstable_batchedUpdates as batchedUpdates} from 'react-dom';
1514
import {useLocalStorage, useSubscription} from '../hooks';
1615
import {
1716
TreeDispatcherContext,
@@ -166,31 +165,28 @@ function ProfilerContextController({children}: Props): React.Node {
166165
);
167166

168167
if (prevProfilingData !== profilingData) {
169-
batchedUpdates(() => {
170-
setPrevProfilingData(profilingData);
171-
172-
const dataForRoots =
173-
profilingData !== null ? profilingData.dataForRoots : null;
174-
if (dataForRoots != null) {
175-
const firstRootID = dataForRoots.keys().next().value || null;
176-
177-
if (rootID === null || !dataForRoots.has(rootID)) {
178-
let selectedElementRootID = null;
179-
if (inspectedElementID !== null) {
180-
selectedElementRootID =
181-
store.getRootIDForElement(inspectedElementID);
182-
}
183-
if (
184-
selectedElementRootID !== null &&
185-
dataForRoots.has(selectedElementRootID)
186-
) {
187-
setRootIDAndClearFiber(selectedElementRootID);
188-
} else {
189-
setRootIDAndClearFiber(firstRootID);
190-
}
168+
setPrevProfilingData(profilingData);
169+
170+
const dataForRoots =
171+
profilingData !== null ? profilingData.dataForRoots : null;
172+
if (dataForRoots != null) {
173+
const firstRootID = dataForRoots.keys().next().value || null;
174+
175+
if (rootID === null || !dataForRoots.has(rootID)) {
176+
let selectedElementRootID = null;
177+
if (inspectedElementID !== null) {
178+
selectedElementRootID = store.getRootIDForElement(inspectedElementID);
179+
}
180+
if (
181+
selectedElementRootID !== null &&
182+
dataForRoots.has(selectedElementRootID)
183+
) {
184+
setRootIDAndClearFiber(selectedElementRootID);
185+
} else {
186+
setRootIDAndClearFiber(firstRootID);
191187
}
192188
}
193-
});
189+
}
194190
}
195191

196192
const [isCommitFilterEnabled, setIsCommitFilterEnabled] =
@@ -229,15 +225,13 @@ function ProfilerContextController({children}: Props): React.Node {
229225
);
230226

231227
if (isProfiling) {
232-
batchedUpdates(() => {
233-
if (selectedCommitIndex !== null) {
234-
selectCommitIndex(null);
235-
}
236-
if (selectedFiberID !== null) {
237-
selectFiberID(null);
238-
selectFiberName(null);
239-
}
240-
});
228+
if (selectedCommitIndex !== null) {
229+
selectCommitIndex(null);
230+
}
231+
if (selectedFiberID !== null) {
232+
selectFiberID(null);
233+
selectFiberName(null);
234+
}
241235
}
242236

243237
const value = useMemo(

packages/react-devtools-shared/src/devtools/views/UnsupportedVersionDialog.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import * as React from 'react';
1111
import {Fragment, useContext, useEffect, useState} from 'react';
12-
import {unstable_batchedUpdates as batchedUpdates} from 'react-dom';
1312
import {ModalDialogContext} from './ModalDialog';
1413
import {StoreContext} from './context';
1514
import {UNSUPPORTED_VERSION_URL} from '../constants';
@@ -26,14 +25,12 @@ export default function UnsupportedVersionDialog(_: {}): null {
2625
useEffect(() => {
2726
if (state === 'dialog-not-shown') {
2827
const showDialog = () => {
29-
batchedUpdates(() => {
30-
setState('show-dialog');
31-
dispatch({
32-
canBeDismissed: true,
33-
id: 'UnsupportedVersionDialog',
34-
type: 'SHOW',
35-
content: <DialogContent />,
36-
});
28+
setState('show-dialog');
29+
dispatch({
30+
canBeDismissed: true,
31+
id: 'UnsupportedVersionDialog',
32+
type: 'SHOW',
33+
content: <DialogContent />,
3734
});
3835
};
3936

0 commit comments

Comments
 (0)