You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do not passthrough logbox errors that already have a component stack
Summary:
In facebook/react#29839 we removed the `Warning: ` prefix. This PR replaces the special cases in LogBox for `Warning: ` to use the presence of a component stack instead. This is what LogBox really cares about anyway, since the reason to let errors pass through to the exception manager is to let DevTools add the component stacks.
Changelog: [General] [Fix] Fix logbox reporting for React errors
Differential Revision: D58441017
'Warning: Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',
127
+
'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',
128
128
message: {
129
129
content:
130
-
'Warning: Each child in a list should have a unique "key" prop.\n\nCheck the render method of `MyOtherComponent`. See https://fb.me/react-warning-keys for more information.',
130
+
'Each child in a list should have a unique "key" prop.\n\nCheck the render method of `MyOtherComponent`. See https://fb.me/react-warning-keys for more information.',
'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s',
167
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s',
168
168
message: {
169
169
content:
170
-
'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?\n\nCheck the render method of `Container(Component)`.',
170
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?\n\nCheck the render method of `Container(Component)`.',
171
171
substitutions: [
172
172
{
173
173
length: 52,
174
-
offset: 129,
174
+
offset: 120,
175
175
},
176
176
],
177
177
},
@@ -801,7 +801,7 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
801
801
it('detects a component stack in an interpolated warning',()=>{
802
802
expect(
803
803
parseLogBoxLog([
804
-
'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s%s',
804
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s%s',
805
805
'\n\nCheck the render method of `MyComponent`.',
806
806
'\n in MyComponent (created by MyOtherComponent)\n in MyOtherComponent (created by MyComponent)\n in MyAppComponent (created by MyOtherComponent)',
807
807
]),
@@ -825,14 +825,14 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
825
825
},
826
826
],
827
827
category:
828
-
'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s',
828
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s',
829
829
message: {
830
830
content:
831
-
'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?\n\nCheck the render method of `MyComponent`.',
831
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?\n\nCheck the render method of `MyComponent`.',
832
832
substitutions: [
833
833
{
834
834
length: 43,
835
-
offset: 129,
835
+
offset: 120,
836
836
},
837
837
],
838
838
},
@@ -907,7 +907,7 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
907
907
it('detects a component stack in the nth argument',()=>{
908
908
expect(
909
909
parseLogBoxLog([
910
-
'Warning: Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.%s',
910
+
'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.%s',
911
911
'\n\nCheck the render method of `MyOtherComponent`.',
912
912
'',
913
913
'\n in MyComponent (created by MyOtherComponent)\n in MyOtherComponent (created by MyComponent)\n in MyAppComponent (created by MyOtherComponent)',
@@ -932,18 +932,18 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
932
932
},
933
933
],
934
934
category:
935
-
'Warning: Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',
935
+
'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',
936
936
message: {
937
937
content:
938
-
'Warning: Each child in a list should have a unique "key" prop.\n\nCheck the render method of `MyOtherComponent`. See https://fb.me/react-warning-keys for more information.',
938
+
'Each child in a list should have a unique "key" prop.\n\nCheck the render method of `MyOtherComponent`. See https://fb.me/react-warning-keys for more information.',
939
939
substitutions: [
940
940
{
941
941
length: 48,
942
-
offset: 62,
942
+
offset: 53,
943
943
},
944
944
{
945
945
length: 0,
946
-
offset: 110,
946
+
offset: 101,
947
947
},
948
948
],
949
949
},
@@ -1076,7 +1076,7 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
1076
1076
it('detects a component stack in an interpolated warning',()=>{
1077
1077
expect(
1078
1078
parseLogBoxLog([
1079
-
'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s%s',
1079
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s%s',
1080
1080
'\n\nCheck the render method of `MyComponent`.',
1081
1081
'\n at MyComponent (/path/to/filename.js:1:2)\n at MyOtherComponent\n at MyAppComponent (/path/to/app.js:100:20)',
1082
1082
]),
@@ -1099,14 +1099,14 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
1099
1099
},
1100
1100
],
1101
1101
category:
1102
-
'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s',
1102
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s',
1103
1103
message: {
1104
1104
content:
1105
-
'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?\n\nCheck the render method of `MyComponent`.',
1105
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?\n\nCheck the render method of `MyComponent`.',
1106
1106
substitutions: [
1107
1107
{
1108
1108
length: 43,
1109
-
offset: 129,
1109
+
offset: 120,
1110
1110
},
1111
1111
],
1112
1112
},
@@ -1179,7 +1179,7 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
1179
1179
it('detects a component stack in the nth argument',()=>{
1180
1180
expect(
1181
1181
parseLogBoxLog([
1182
-
'Warning: Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.%s',
1182
+
'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.%s',
1183
1183
'\n\nCheck the render method of `MyOtherComponent`.',
1184
1184
'',
1185
1185
'\n at MyComponent (/path/to/filename.js:1:2)\n at MyOtherComponent\n at MyAppComponent (/path/to/app.js:100:20)',
@@ -1203,18 +1203,18 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
1203
1203
},
1204
1204
],
1205
1205
category:
1206
-
'Warning: Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',
1206
+
'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',
1207
1207
message: {
1208
1208
content:
1209
-
'Warning: Each child in a list should have a unique "key" prop.\n\nCheck the render method of `MyOtherComponent`. See https://fb.me/react-warning-keys for more information.',
1209
+
'Each child in a list should have a unique "key" prop.\n\nCheck the render method of `MyOtherComponent`. See https://fb.me/react-warning-keys for more information.',
1210
1210
substitutions: [
1211
1211
{
1212
1212
length: 48,
1213
-
offset: 62,
1213
+
offset: 53,
1214
1214
},
1215
1215
{
1216
1216
length: 0,
1217
-
offset: 110,
1217
+
offset: 101,
1218
1218
},
1219
1219
],
1220
1220
},
@@ -1285,7 +1285,7 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
1285
1285
it('detects a component stack in an interpolated warning',()=>{
1286
1286
expect(
1287
1287
parseLogBoxLog([
1288
-
'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s%s',
1288
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s%s',
@@ -1312,14 +1312,14 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
1312
1312
},
1313
1313
],
1314
1314
category:
1315
-
'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s',
1315
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s',
1316
1316
message: {
1317
1317
content:
1318
-
'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?\n\nCheck the render method of `MyComponent`.',
1318
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?\n\nCheck the render method of `MyComponent`.',
1319
1319
substitutions: [
1320
1320
{
1321
1321
length: 43,
1322
-
offset: 129,
1322
+
offset: 120,
1323
1323
},
1324
1324
],
1325
1325
},
@@ -1484,7 +1484,7 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
1484
1484
it('detects a component stack in the nth argument',()=>{
1485
1485
expect(
1486
1486
parseLogBoxLog([
1487
-
'Warning: Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.%s',
1487
+
'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.%s',
1488
1488
'\n\nCheck the render method of `MyOtherComponent`.',
@@ -1512,18 +1512,18 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
1512
1512
},
1513
1513
],
1514
1514
category:
1515
-
'Warning: Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',
1515
+
'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',
1516
1516
message: {
1517
1517
content:
1518
-
'Warning: Each child in a list should have a unique "key" prop.\n\nCheck the render method of `MyOtherComponent`. See https://fb.me/react-warning-keys for more information.',
1518
+
'Each child in a list should have a unique "key" prop.\n\nCheck the render method of `MyOtherComponent`. See https://fb.me/react-warning-keys for more information.',
0 commit comments