Skip to content

Commit

Permalink
refactor: remove source usages from getInspectorData
Browse files Browse the repository at this point in the history
Summary:
Changelog: [Internal]

Required for landing D53543159.

3 reasons for landing this:
1. Inspector is technically deprecated and will be removed once React DevTools are shipped with Chrome DevTools for RN debugging.
2. Long-term solution for source fetching is lazy loading based on component stacks - facebook/react#28265
3. Although `source` field is accumulated and stored, it is not displayed anywhere, see InspectorOverlay.js.

Differential Revision: D53757524
  • Loading branch information
hoxyq authored and facebook-github-bot committed Feb 14, 2024
1 parent a68ae2e commit d1d6396
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/react-native/Libraries/Inspector/Inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ type SelectedTab =
| 'performance-profiling';

export type InspectedElementFrame = TouchedViewDataAtPoint['frame'];
export type InspectedElementSource = InspectorData['source'];
export type InspectedElement = $ReadOnly<{
frame: InspectedElementFrame,
source?: InspectedElementSource,
style?: ViewStyleProp,
}>;
export type ElementsHierarchy = InspectorData['hierarchy'];
Expand Down Expand Up @@ -74,14 +72,12 @@ function Inspector({
}

// We pass in findNodeHandle as the method is injected
const {measure, props, source} =
hierarchyItem.getInspectorData(findNodeHandle);
const {measure, props} = hierarchyItem.getInspectorData(findNodeHandle);

measure((x, y, width, height, left, top) => {
// $FlowFixMe[incompatible-call] `props` from InspectorData are defined as <string, string> dictionary, which is incompatible with ViewStyleProp
setInspectedElement({
frame: {left, top, width, height},
source,
style: props.style,
});

Expand All @@ -95,7 +91,6 @@ function Inspector({
hierarchy,
props,
selectedIndex,
source,
frame,
pointerY,
touchedViewTag,
Expand All @@ -120,7 +115,6 @@ function Inspector({
// $FlowFixMe[incompatible-call] `props` from InspectorData are defined as <string, string> dictionary, which is incompatible with ViewStyleProp
setInspectedElement({
frame,
source,
style: props.style,
});
};
Expand Down

0 comments on commit d1d6396

Please sign in to comment.