Skip to content

Commit 5575e5c

Browse files
committed
[refactor] clean up describeNativeComponentFrame
1 parent 9e2c233 commit 5575e5c

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

packages/react-devtools-shared/src/backend/shared/DevToolsComponentStackFrame.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ if (__DEV__) {
5151
componentFrameCache = new PossiblyWeakMap<$FlowFixMe, string>();
5252
}
5353

54-
export function describeNativeComponentFrame(
54+
export function describeFunctionComponentFrame(
5555
fn: Function,
5656
construct: boolean,
5757
currentDispatcherRef: CurrentDispatcherRef,
@@ -280,12 +280,5 @@ export function describeClassComponentFrame(
280280
ctor: Function,
281281
currentDispatcherRef: CurrentDispatcherRef,
282282
): string {
283-
return describeNativeComponentFrame(ctor, true, currentDispatcherRef);
284-
}
285-
286-
export function describeFunctionComponentFrame(
287-
fn: Function,
288-
currentDispatcherRef: CurrentDispatcherRef,
289-
): string {
290-
return describeNativeComponentFrame(fn, false, currentDispatcherRef);
283+
return describeFunctionComponentFrame(ctor, true, currentDispatcherRef);
291284
}

packages/shared/ReactComponentStackFrame.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ if (__DEV__) {
7070
* (3) diffing the control and sample error stacks to find the stack frame
7171
* which represents our component.
7272
*/
73-
export function describeNativeComponentFrame(
73+
export function describeFunctionComponentFrame(
7474
fn: Function,
7575
construct: boolean,
7676
): string {
@@ -291,11 +291,7 @@ export function describeNativeComponentFrame(
291291
}
292292

293293
export function describeClassComponentFrame(ctor: Function): string {
294-
return describeNativeComponentFrame(ctor, true);
295-
}
296-
297-
export function describeFunctionComponentFrame(fn: Function): string {
298-
return describeNativeComponentFrame(fn, false);
294+
return describeFunctionComponentFrame(ctor, true);
299295
}
300296

301297
function shouldConstruct(Component: Function) {
@@ -312,7 +308,7 @@ export function describeUnknownElementTypeFrameInDEV(type: any): string {
312308
return '';
313309
}
314310
if (typeof type === 'function') {
315-
return describeNativeComponentFrame(type, shouldConstruct(type));
311+
return describeFunctionComponentFrame(type, shouldConstruct(type));
316312
}
317313
if (typeof type === 'string') {
318314
return describeBuiltInComponentFrame(type);

0 commit comments

Comments
 (0)