Skip to content

Commit 1c6b5b3

Browse files
author
Brian Vaughn
committed
Renamed inspected hook isEditable to isStateEditable
1 parent dc1517a commit 1c6b5b3

File tree

3 files changed

+193
-73
lines changed

3 files changed

+193
-73
lines changed

packages/react-debug-tools/src/ReactDebugHooks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ const Dispatcher: DispatcherType = {
233233

234234
type HooksNode = {
235235
index: number,
236-
isEditable: boolean,
236+
isStateEditable: boolean,
237237
name: string,
238238
value: mixed,
239239
subHooks: Array<HooksNode>,
@@ -407,7 +407,7 @@ function buildTree(rootStack, readHookLog): HooksTree {
407407
let children = [];
408408
levelChildren.push({
409409
index: -1,
410-
isEditable: false,
410+
isStateEditable: false,
411411
name: parseCustomHookName(stack[j - 1].functionName),
412412
value: undefined,
413413
subHooks: children,
@@ -420,7 +420,7 @@ function buildTree(rootStack, readHookLog): HooksTree {
420420
const {primitive} = hook;
421421
levelChildren.push({
422422
index: primitive === 'DebugValue' ? -1 : index++,
423-
isEditable: primitive === 'Reducer' || primitive === 'State',
423+
isStateEditable: primitive === 'Reducer' || primitive === 'State',
424424
name: primitive,
425425
value: hook.value,
426426
subHooks: [],

packages/react-debug-tools/src/__tests__/ReactHooksInspection-test.js

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('ReactHooksInspection', () => {
2828
let tree = ReactDebugTools.inspectHooks(Foo, {});
2929
expect(tree).toEqual([
3030
{
31-
isEditable: true,
31+
isStateEditable: true,
3232
index: 0,
3333
name: 'State',
3434
value: 'hello world',
@@ -50,13 +50,13 @@ describe('ReactHooksInspection', () => {
5050
let tree = ReactDebugTools.inspectHooks(Foo, {});
5151
expect(tree).toEqual([
5252
{
53-
isEditable: false,
53+
isStateEditable: false,
5454
index: -1,
5555
name: 'Custom',
5656
value: __DEV__ ? 'custom hook label' : undefined,
5757
subHooks: [
5858
{
59-
isEditable: true,
59+
isStateEditable: true,
6060
index: 0,
6161
name: 'State',
6262
value: 'hello world',
@@ -86,20 +86,20 @@ describe('ReactHooksInspection', () => {
8686
let tree = ReactDebugTools.inspectHooks(Foo, {});
8787
expect(tree).toEqual([
8888
{
89-
isEditable: false,
89+
isStateEditable: false,
9090
index: -1,
9191
name: 'Custom',
9292
value: undefined,
9393
subHooks: [
9494
{
95-
isEditable: true,
95+
isStateEditable: true,
9696
index: 0,
9797
name: 'State',
9898
subHooks: [],
9999
value: 'hello',
100100
},
101101
{
102-
isEditable: false,
102+
isStateEditable: false,
103103
index: 1,
104104
name: 'Effect',
105105
subHooks: [],
@@ -108,20 +108,20 @@ describe('ReactHooksInspection', () => {
108108
],
109109
},
110110
{
111-
isEditable: false,
111+
isStateEditable: false,
112112
index: -1,
113113
name: 'Custom',
114114
value: undefined,
115115
subHooks: [
116116
{
117-
isEditable: true,
117+
isStateEditable: true,
118118
index: 2,
119119
name: 'State',
120120
value: 'world',
121121
subHooks: [],
122122
},
123123
{
124-
isEditable: false,
124+
isStateEditable: false,
125125
index: 3,
126126
name: 'Effect',
127127
value: effect,
@@ -161,26 +161,26 @@ describe('ReactHooksInspection', () => {
161161
let tree = ReactDebugTools.inspectHooks(Foo, {});
162162
expect(tree).toEqual([
163163
{
164-
isEditable: false,
164+
isStateEditable: false,
165165
index: -1,
166166
name: 'Bar',
167167
value: undefined,
168168
subHooks: [
169169
{
170-
isEditable: false,
170+
isStateEditable: false,
171171
index: -1,
172172
name: 'Custom',
173173
value: undefined,
174174
subHooks: [
175175
{
176-
isEditable: true,
176+
isStateEditable: true,
177177
index: 0,
178178
name: 'Reducer',
179179
value: 'hello',
180180
subHooks: [],
181181
},
182182
{
183-
isEditable: false,
183+
isStateEditable: false,
184184
index: 1,
185185
name: 'Effect',
186186
value: effect,
@@ -189,7 +189,7 @@ describe('ReactHooksInspection', () => {
189189
],
190190
},
191191
{
192-
isEditable: false,
192+
isStateEditable: false,
193193
index: 2,
194194
name: 'LayoutEffect',
195195
value: effect,
@@ -198,32 +198,32 @@ describe('ReactHooksInspection', () => {
198198
],
199199
},
200200
{
201-
isEditable: false,
201+
isStateEditable: false,
202202
index: -1,
203203
name: 'Baz',
204204
value: undefined,
205205
subHooks: [
206206
{
207-
isEditable: false,
207+
isStateEditable: false,
208208
index: 3,
209209
name: 'LayoutEffect',
210210
value: effect,
211211
subHooks: [],
212212
},
213213
{
214-
isEditable: false,
214+
isStateEditable: false,
215215
index: -1,
216216
name: 'Custom',
217217
subHooks: [
218218
{
219-
isEditable: true,
219+
isStateEditable: true,
220220
index: 4,
221221
name: 'Reducer',
222222
subHooks: [],
223223
value: 'world',
224224
},
225225
{
226-
isEditable: false,
226+
isStateEditable: false,
227227
index: 5,
228228
name: 'Effect',
229229
subHooks: [],
@@ -246,7 +246,7 @@ describe('ReactHooksInspection', () => {
246246
let tree = ReactDebugTools.inspectHooks(Foo, {});
247247
expect(tree).toEqual([
248248
{
249-
isEditable: false,
249+
isStateEditable: false,
250250
index: 0,
251251
name: 'Context',
252252
value: 'default',
@@ -310,12 +310,18 @@ describe('ReactHooksInspection', () => {
310310
let tree = ReactDebugTools.inspectHooks(Foo, {});
311311
expect(tree).toEqual([
312312
{
313-
isEditable: false,
313+
isStateEditable: false,
314314
index: -1,
315315
name: 'Custom',
316316
value: __DEV__ ? 'bar:123' : undefined,
317317
subHooks: [
318-
{isEditable: true, index: 0, name: 'State', subHooks: [], value: 0},
318+
{
319+
isStateEditable: true,
320+
index: 0,
321+
name: 'State',
322+
subHooks: [],
323+
value: 0,
324+
},
319325
],
320326
},
321327
]);

0 commit comments

Comments
 (0)