Skip to content

Commit ec372fa

Browse files
author
Brian Vaughn
authored
Remove DevTools dependency on Scheduler runWithPriority (#20967)
1 parent e4d4b70 commit ec372fa

File tree

3 files changed

+5
-66
lines changed

3 files changed

+5
-66
lines changed

packages/react-devtools-shared/src/devtools/views/Components/TreeContext.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,8 @@ import {
3434
useMemo,
3535
useReducer,
3636
useRef,
37+
unstable_startTransition as startTransition,
3738
} from 'react';
38-
import {
39-
unstable_next as next,
40-
unstable_runWithPriority as runWithPriority,
41-
unstable_UserBlockingPriority as UserBlockingPriority,
42-
} from 'scheduler';
4339
import {createRegExp} from '../utils';
4440
import {BridgeContext, StoreContext} from '../context';
4541
import Store from '../../store';
@@ -923,11 +919,10 @@ function TreeContextController({
923919

924920
const dispatchWrapper = useCallback(
925921
(action: Action) => {
926-
// Run the first update at "user-blocking" priority in case dispatch is called from a non-React event.
927-
// In this case, the current (and "next") priorities would both be "normal",
928-
// and suspense would potentially block both updates.
929-
runWithPriority(UserBlockingPriority, () => dispatch(action));
930-
next(() => dispatch({type: 'UPDATE_INSPECTED_ELEMENT_ID'}));
922+
dispatch(action);
923+
startTransition(() => {
924+
dispatch({type: 'UPDATE_INSPECTED_ELEMENT_ID'});
925+
});
931926
},
932927
[dispatch],
933928
);

packages/react-devtools-shell/src/app/PriorityLevels/index.js

Lines changed: 0 additions & 54 deletions
This file was deleted.

packages/react-devtools-shell/src/app/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import Hydration from './Hydration';
1515
import InlineWarnings from './InlineWarnings';
1616
import InspectableElements from './InspectableElements';
1717
import InteractionTracing from './InteractionTracing';
18-
import PriorityLevels from './PriorityLevels';
1918
import ReactNativeWeb from './ReactNativeWeb';
2019
import ToDoList from './ToDoList';
2120
import Toggle from './Toggle';
@@ -55,7 +54,6 @@ function mountTestApp() {
5554
mountHelper(ElementTypes);
5655
mountHelper(EditableProps);
5756
mountHelper(InlineWarnings);
58-
mountHelper(PriorityLevels);
5957
mountHelper(ReactNativeWeb);
6058
mountHelper(Toggle);
6159
mountHelper(SuspenseTree);

0 commit comments

Comments
 (0)