Skip to content

Commit d96eecb

Browse files
committed
Remove enableComponentStackLocations
1 parent 08dfd0b commit d96eecb

9 files changed

+22
-192
lines changed

packages/shared/ReactComponentStackFrame.js

Lines changed: 21 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
import type {LazyComponent} from 'react/src/ReactLazy';
1111

12-
import {enableComponentStackLocations} from 'shared/ReactFeatureFlags';
13-
1412
import {
1513
REACT_SUSPENSE_TYPE,
1614
REACT_SUSPENSE_LIST_TYPE,
@@ -28,30 +26,26 @@ import DefaultPrepareStackTrace from 'shared/DefaultPrepareStackTrace';
2826
let prefix;
2927
let suffix;
3028
export function describeBuiltInComponentFrame(name: string): string {
31-
if (enableComponentStackLocations) {
32-
if (prefix === undefined) {
33-
// Extract the VM specific prefix used by each line.
34-
try {
35-
throw Error();
36-
} catch (x) {
37-
const match = x.stack.trim().match(/\n( *(at )?)/);
38-
prefix = (match && match[1]) || '';
39-
suffix =
40-
x.stack.indexOf('\n at') > -1
41-
? // V8
42-
' (<anonymous>)'
43-
: // JSC/Spidermonkey
44-
x.stack.indexOf('@') > -1
45-
? '@unknown:0:0'
46-
: // Other
47-
'';
48-
}
29+
if (prefix === undefined) {
30+
// Extract the VM specific prefix used by each line.
31+
try {
32+
throw Error();
33+
} catch (x) {
34+
const match = x.stack.trim().match(/\n( *(at )?)/);
35+
prefix = (match && match[1]) || '';
36+
suffix =
37+
x.stack.indexOf('\n at') > -1
38+
? // V8
39+
' (<anonymous>)'
40+
: // JSC/Spidermonkey
41+
x.stack.indexOf('@') > -1
42+
? '@unknown:0:0'
43+
: // Other
44+
'';
4945
}
50-
// We use the prefix to ensure our stacks line up with native stack frames.
51-
return '\n' + prefix + name + suffix;
52-
} else {
53-
return describeComponentFrame(name);
5446
}
47+
// We use the prefix to ensure our stacks line up with native stack frames.
48+
return '\n' + prefix + name + suffix;
5549
}
5650

5751
export function describeDebugInfoFrame(name: string, env: ?string): string {
@@ -296,28 +290,12 @@ export function describeNativeComponentFrame(
296290
return syntheticFrame;
297291
}
298292

299-
function describeComponentFrame(name: null | string) {
300-
return '\n in ' + (name || 'Unknown');
301-
}
302-
303293
export function describeClassComponentFrame(ctor: Function): string {
304-
if (enableComponentStackLocations) {
305-
return describeNativeComponentFrame(ctor, true);
306-
} else {
307-
return describeFunctionComponentFrame(ctor);
308-
}
294+
return describeNativeComponentFrame(ctor, true);
309295
}
310296

311297
export function describeFunctionComponentFrame(fn: Function): string {
312-
if (enableComponentStackLocations) {
313-
return describeNativeComponentFrame(fn, false);
314-
} else {
315-
if (!fn) {
316-
return '';
317-
}
318-
const name = fn.displayName || fn.name || null;
319-
return describeComponentFrame(name);
320-
}
298+
return describeNativeComponentFrame(fn, false);
321299
}
322300

323301
function shouldConstruct(Component: Function) {
@@ -334,11 +312,7 @@ export function describeUnknownElementTypeFrameInDEV(type: any): string {
334312
return '';
335313
}
336314
if (typeof type === 'function') {
337-
if (enableComponentStackLocations) {
338-
return describeNativeComponentFrame(type, shouldConstruct(type));
339-
} else {
340-
return describeFunctionComponentFrame(type);
341-
}
315+
return describeNativeComponentFrame(type, shouldConstruct(type));
342316
}
343317
if (typeof type === 'string') {
344318
return describeBuiltInComponentFrame(type);

packages/shared/ReactFeatureFlags.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Flags that can likely be deleted or landed without consequences
1414
// -----------------------------------------------------------------------------
1515

16-
export const enableComponentStackLocations = true;
16+
// None
1717

1818
// -----------------------------------------------------------------------------
1919
// Killswitch

packages/shared/__tests__/describeComponentFrame-test.js

Lines changed: 0 additions & 137 deletions
This file was deleted.

packages/shared/forks/ReactFeatureFlags.native-fb.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ export const disableTextareaChildren = false;
4545
export const enableAsyncDebugInfo = false;
4646
export const enableAsyncIterableChildren = false;
4747
export const enableCache = true;
48-
export const enableComponentStackLocations = true;
4948
export const enableCPUSuspense = true;
5049
export const enableCreateEventHandleAPI = false;
5150
export const enableDebugTracing = false;

packages/shared/forks/ReactFeatureFlags.native-oss.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export const disableTextareaChildren = false;
3232
export const enableAsyncDebugInfo = false;
3333
export const enableAsyncIterableChildren = false;
3434
export const enableCache = true;
35-
export const enableComponentStackLocations = true;
3635
export const enableCPUSuspense = false;
3736
export const enableCreateEventHandleAPI = false;
3837
export const enableDebugTracing = false;

packages/shared/forks/ReactFeatureFlags.test-renderer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export const enableUseMemoCacheHook = true;
4040
export const enableNoCloningMemoCache = false;
4141
export const enableUseEffectEventHook = false;
4242
export const favorSafetyOverHydrationPerf = true;
43-
export const enableComponentStackLocations = true;
4443
export const enableLegacyFBSupport = false;
4544
export const enableFilterEmptyStringAttributesDOM = true;
4645
export const enableMoveBefore = false;

packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export const disableTextareaChildren = false;
2424
export const enableAsyncDebugInfo = false;
2525
export const enableAsyncIterableChildren = false;
2626
export const enableCache = true;
27-
export const enableComponentStackLocations = true;
2827
export const enableCPUSuspense = true;
2928
export const enableCreateEventHandleAPI = false;
3029
export const enableDebugTracing = false;

packages/shared/forks/ReactFeatureFlags.test-renderer.www.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export const enableUseMemoCacheHook = true;
4242
export const enableNoCloningMemoCache = false;
4343
export const enableUseEffectEventHook = false;
4444
export const favorSafetyOverHydrationPerf = true;
45-
export const enableComponentStackLocations = true;
4645
export const enableLegacyFBSupport = false;
4746
export const enableFilterEmptyStringAttributesDOM = true;
4847
export const enableMoveBefore = false;

packages/shared/forks/ReactFeatureFlags.www.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ export const enableSuspenseCallback = true;
9999

100100
export const enableLegacyHidden = true;
101101

102-
export const enableComponentStackLocations = true;
103-
104102
export const disableTextareaChildren = __EXPERIMENTAL__;
105103

106104
export const enableFizzExternalRuntime = true;

0 commit comments

Comments
 (0)