Skip to content

Commit e34c3df

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

File tree

1 file changed

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

1 file changed

+12
-8
lines changed

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -891,19 +891,23 @@ function TreeContextController({
891891
? store.getIndexOfElementID(store.lastSelectedHostInstanceElementId)
892892
: null,
893893
});
894-
const dispatchWrapper = useMemo(
895-
() => (action: Action) => startTransition(() => dispatch(action)),
894+
const transitionDispatch = useMemo(
895+
() => (action: Action) =>
896+
startTransition(() => {
897+
console.log(new Error());
898+
dispatch(action);
899+
}),
896900
[dispatch],
897901
);
898902

899903
// Listen for host element selections.
900904
useEffect(() => {
901905
const handler = (id: Element['id']) =>
902-
dispatchWrapper({type: 'SELECT_ELEMENT_BY_ID', payload: id});
906+
transitionDispatch({type: 'SELECT_ELEMENT_BY_ID', payload: id});
903907

904908
store.addListener('hostInstanceSelected', handler);
905909
return () => store.removeListener('hostInstanceSelected', handler);
906-
}, [store, dispatchWrapper]);
910+
}, [store, transitionDispatch]);
907911

908912
// If a newly-selected search result or inspection selection is inside of a collapsed subtree, auto expand it.
909913
// This needs to be a layout effect to avoid temporarily flashing an incorrect selection.
@@ -927,7 +931,7 @@ function TreeContextController({
927931
Array<number>,
928932
Map<number, number>,
929933
]) => {
930-
dispatchWrapper({
934+
transitionDispatch({
931935
type: 'HANDLE_STORE_MUTATION',
932936
payload: [addedElementIDs, removedElementIDs],
933937
});
@@ -938,19 +942,19 @@ function TreeContextController({
938942
// At the moment, we can treat this as a mutation.
939943
// We don't know which Elements were newly added/removed, but that should be okay in this case.
940944
// It would only impact the search state, which is unlikely to exist yet at this point.
941-
dispatchWrapper({
945+
transitionDispatch({
942946
type: 'HANDLE_STORE_MUTATION',
943947
payload: [[], new Map()],
944948
});
945949
}
946950

947951
store.addListener('mutated', handleStoreMutated);
948952
return () => store.removeListener('mutated', handleStoreMutated);
949-
}, [dispatchWrapper, initialRevision, store]);
953+
}, [dispatch, initialRevision, store]);
950954

951955
return (
952956
<TreeStateContext.Provider value={state}>
953-
<TreeDispatcherContext.Provider value={dispatchWrapper}>
957+
<TreeDispatcherContext.Provider value={dispatch}>
954958
{children}
955959
</TreeDispatcherContext.Provider>
956960
</TreeStateContext.Provider>

0 commit comments

Comments
 (0)