Skip to content

Commit e989e7f

Browse files
committed
[devtools] Restore "double-click to view owners tree" functionality
1 parent c498bfc commit e989e7f

File tree

1 file changed

+7
-7
lines changed
  • packages/react-devtools-shared/src/devtools/views/Components

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -891,19 +891,19 @@ function TreeContextController({
891891
? store.getIndexOfElementID(store.lastSelectedHostInstanceElementId)
892892
: null,
893893
});
894-
const dispatchWrapper = useMemo(
894+
const transitionDispatch = useMemo(
895895
() => (action: Action) => startTransition(() => dispatch(action)),
896896
[dispatch],
897897
);
898898

899899
// Listen for host element selections.
900900
useEffect(() => {
901901
const handler = (id: Element['id']) =>
902-
dispatchWrapper({type: 'SELECT_ELEMENT_BY_ID', payload: id});
902+
transitionDispatch({type: 'SELECT_ELEMENT_BY_ID', payload: id});
903903

904904
store.addListener('hostInstanceSelected', handler);
905905
return () => store.removeListener('hostInstanceSelected', handler);
906-
}, [store, dispatchWrapper]);
906+
}, [store, transitionDispatch]);
907907

908908
// If a newly-selected search result or inspection selection is inside of a collapsed subtree, auto expand it.
909909
// This needs to be a layout effect to avoid temporarily flashing an incorrect selection.
@@ -927,7 +927,7 @@ function TreeContextController({
927927
Array<number>,
928928
Map<number, number>,
929929
]) => {
930-
dispatchWrapper({
930+
transitionDispatch({
931931
type: 'HANDLE_STORE_MUTATION',
932932
payload: [addedElementIDs, removedElementIDs],
933933
});
@@ -938,19 +938,19 @@ function TreeContextController({
938938
// At the moment, we can treat this as a mutation.
939939
// We don't know which Elements were newly added/removed, but that should be okay in this case.
940940
// It would only impact the search state, which is unlikely to exist yet at this point.
941-
dispatchWrapper({
941+
dispatch({
942942
type: 'HANDLE_STORE_MUTATION',
943943
payload: [[], new Map()],
944944
});
945945
}
946946

947947
store.addListener('mutated', handleStoreMutated);
948948
return () => store.removeListener('mutated', handleStoreMutated);
949-
}, [dispatchWrapper, initialRevision, store]);
949+
}, [dispatch, initialRevision, store]);
950950

951951
return (
952952
<TreeStateContext.Provider value={state}>
953-
<TreeDispatcherContext.Provider value={dispatchWrapper}>
953+
<TreeDispatcherContext.Provider value={dispatch}>
954954
{children}
955955
</TreeDispatcherContext.Provider>
956956
</TreeStateContext.Provider>

0 commit comments

Comments
 (0)