Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devtools: Show inspectedElement key in right pane #18737

Merged
merged 9 commits into from
May 11, 2020
Prev Previous commit
Next Next commit
Move key to left of component name
  • Loading branch information
bvaughn authored May 11, 2020
commit d61fbdc1db42b4ee6a04e28ee7d2f825419d724a
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,15 @@ export default function SelectedElement(_: Props) {
return (
<div className={styles.SelectedElement}>
<div className={styles.TitleRow}>
{element.key && (
<>
<div className={styles.Key} title={`key "${element.key}"`}>
{element.key}
</div>
<div className={styles.KeyArrow} />
</>
)}

<div className={styles.SelectedComponentName}>
<div className={styles.Component} title={element.displayName}>
{element.displayName}
Expand Down Expand Up @@ -284,7 +293,6 @@ function InspectedElementView({
props,
source,
state,
key,
} = inspectedElement;

const {ownerID} = useContext(TreeStateContext);
Expand All @@ -302,12 +310,6 @@ function InspectedElementView({
},
[getInspectedElementPath, id],
);
const inspectKeyPath = useCallback(
(path: Array<string | number>) => {
getInspectedElementPath(id, ['key', ...path]);
},
[getInspectedElementPath, id],
);
const inspectPropsPath = useCallback(
(path: Array<string | number>) => {
getInspectedElementPath(id, ['props', ...path]);
Expand Down Expand Up @@ -376,14 +378,6 @@ function InspectedElementView({
<Fragment>
<div className={styles.InspectedElement}>
<HocBadges element={element} />
{key && (
<InspectedElementTree
label=""
data={{key: key}}
inspectPath={inspectKeyPath}
pathRoot="key"
/>
)}
<InspectedElementTree
label="props"
data={props}
Expand Down