Skip to content

Commit 392ad71

Browse files
author
Brian Vaughn
committed
Destructuring nit
1 parent 2276ebd commit 392ad71

File tree

1 file changed

+22
-22
lines changed
  • packages/react-devtools-shared/src/devtools/views/Profiler

1 file changed

+22
-22
lines changed

packages/react-devtools-shared/src/devtools/views/Profiler/WhatChanged.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,16 @@ export default function WhatChanged({fiberID}: Props) {
6363
return null;
6464
}
6565

66-
if (changeDescription.isFirstMount) {
66+
const {
67+
context,
68+
didHooksChange,
69+
hooks,
70+
isFirstMount,
71+
props,
72+
state,
73+
} = changeDescription;
74+
75+
if (isFirstMount) {
6776
return (
6877
<div className={styles.Component}>
6978
<label className={styles.Label}>Why did this render?</label>
@@ -76,21 +85,21 @@ export default function WhatChanged({fiberID}: Props) {
7685

7786
const changes = [];
7887

79-
if (changeDescription.context === true) {
88+
if (context === true) {
8089
changes.push(
8190
<div key="context" className={styles.Item}>
8291
• Context changed
8392
</div>,
8493
);
8594
} else if (
86-
typeof changeDescription.context === 'object' &&
87-
changeDescription.context !== null &&
88-
changeDescription.context.length !== 0
95+
typeof context === 'object' &&
96+
context !== null &&
97+
context.length !== 0
8998
) {
9099
changes.push(
91100
<div key="context" className={styles.Item}>
92101
• Context changed:
93-
{changeDescription.context.map(key => (
102+
{context.map(key => (
94103
<span key={key} className={styles.Key}>
95104
{key}
96105
</span>
@@ -99,14 +108,11 @@ export default function WhatChanged({fiberID}: Props) {
99108
);
100109
}
101110

102-
if (changeDescription.didHooksChange) {
103-
if (
104-
enableProfilerChangedHookIndices &&
105-
Array.isArray(changeDescription.hooks)
106-
) {
111+
if (didHooksChange) {
112+
if (enableProfilerChangedHookIndices && Array.isArray(hooks)) {
107113
changes.push(
108114
<div key="hooks" className={styles.Item}>
109-
{hookIndicesToString(changeDescription.hooks)}
115+
{hookIndicesToString(hooks)}
110116
</div>,
111117
);
112118
} else {
@@ -118,14 +124,11 @@ export default function WhatChanged({fiberID}: Props) {
118124
}
119125
}
120126

121-
if (
122-
changeDescription.props !== null &&
123-
changeDescription.props.length !== 0
124-
) {
127+
if (props !== null && props.length !== 0) {
125128
changes.push(
126129
<div key="props" className={styles.Item}>
127130
• Props changed:
128-
{changeDescription.props.map(key => (
131+
{props.map(key => (
129132
<span key={key} className={styles.Key}>
130133
{key}
131134
</span>
@@ -134,14 +137,11 @@ export default function WhatChanged({fiberID}: Props) {
134137
);
135138
}
136139

137-
if (
138-
changeDescription.state !== null &&
139-
changeDescription.state.length !== 0
140-
) {
140+
if (state !== null && state.length !== 0) {
141141
changes.push(
142142
<div key="state" className={styles.Item}>
143143
• State changed:
144-
{changeDescription.state.map(key => (
144+
{state.map(key => (
145145
<span key={key} className={styles.Key}>
146146
{key}
147147
</span>

0 commit comments

Comments
 (0)