Skip to content

Commit 7eb3428

Browse files
rickhanloniimeta-codesync[bot]
authored andcommitted
Remove componentStackType from source code (#55229)
Summary: Pull Request resolved: #55229 All component stacks now use the native JS Error stack frame format which gets properly symbolicated. This removes the legacy/stack distinction since the legacy format (custom React string format) is no longer used. After this change, all component stacks will be symbolicated, improving the debugging experience. Changelog: [Internal] Reviewed By: vzaidman, javache Differential Revision: D90888223 fbshipit-source-id: ac0455b3194ccffba8f7102efd42efc25d17a0db
1 parent 0193d27 commit 7eb3428

12 files changed

Lines changed: 32 additions & 172 deletions

File tree

packages/react-native/Libraries/LogBox/Data/LogBoxData.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import type {LogLevel} from './LogBoxLog';
1313
import type {
1414
Category,
1515
ComponentStack,
16-
ComponentStackType,
1716
ExtendedExceptionData,
1817
Message,
1918
} from './parseLogBoxLog';
@@ -32,7 +31,6 @@ export type LogData = Readonly<{
3231
message: Message,
3332
category: Category,
3433
componentStack: ComponentStack,
35-
componentStackType: ComponentStackType | null,
3634
stack?: string,
3735
}>;
3836

@@ -238,7 +236,6 @@ export function addLog(log: LogData): void {
238236
stack,
239237
category: log.category,
240238
componentStack: log.componentStack,
241-
componentStackType: log.componentStackType || 'legacy',
242239
}),
243240
);
244241
} catch (error: unknown) {

packages/react-native/Libraries/LogBox/Data/LogBoxLog.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import type {
1313
Category,
1414
CodeFrame,
1515
ComponentStack,
16-
ComponentStackType,
1716
Message,
1817
} from './parseLogBoxLog';
1918

@@ -61,7 +60,6 @@ export type LogBoxLogData = Readonly<{
6160
message: Message,
6261
stack: Stack,
6362
category: string,
64-
componentStackType?: ComponentStackType,
6563
componentStack: ComponentStack,
6664
codeFrame?: ?CodeFrame,
6765
isComponentError: boolean,
@@ -74,7 +72,6 @@ class LogBoxLog {
7472
type: ?string;
7573
category: Category;
7674
componentStack: ComponentStack;
77-
componentStackType: ComponentStackType;
7875
stack: Stack;
7976
count: number;
8077
level: LogLevel;
@@ -113,7 +110,6 @@ class LogBoxLog {
113110
this.stack = data.stack;
114111
this.category = data.category;
115112
this.componentStack = data.componentStack;
116-
this.componentStackType = data.componentStackType || 'legacy';
117113
this.codeFrame = data.codeFrame;
118114
this.isComponentError = data.isComponentError;
119115
this.extraData = data.extraData;
@@ -132,9 +128,6 @@ class LogBoxLog {
132128
}
133129

134130
getAvailableComponentStack(): ComponentStack {
135-
if (this.componentStackType === 'legacy') {
136-
return this.componentStack;
137-
}
138131
return this.symbolicatedComponentStack.status === 'COMPLETE'
139132
? this.symbolicatedComponentStack.componentStack
140133
: this.componentStack;
@@ -180,7 +173,7 @@ class LogBoxLog {
180173
}
181174
if (
182175
this.componentStack != null &&
183-
this.componentStackType === 'stack' &&
176+
this.componentStack.length > 0 &&
184177
this.symbolicatedComponentStack.status !== 'PENDING' &&
185178
this.symbolicatedComponentStack.status !== 'COMPLETE'
186179
) {
@@ -192,6 +185,7 @@ class LogBoxLog {
192185
data => {
193186
this.updateComponentStackStatus(
194187
null,
188+
// TODO: we shouldn't need to convert back to ComponentStack any more
195189
convertStackToComponentStack(data.stack),
196190
data?.codeFrame,
197191
callback,

packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxData-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ const addLogs = (logs: Array<string>, options: void | {flush: boolean}) => {
6565
},
6666
category: message,
6767
componentStack: [],
68-
componentStackType: null,
6968
});
7069
if (options == null || options.flush !== false) {
7170
jest.runOnlyPendingTimers();

packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxLog-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ function getLogBoxLog() {
4747
message: {content: '...', substitutions: []},
4848
stack: createStack(['A', 'B', 'C']),
4949
category: 'Message category...',
50-
componentStackType: 'stack',
5150
componentStack: createComponentStack(['A', 'B', 'C']),
5251
codeFrame: null,
5352
});

0 commit comments

Comments
 (0)