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 (#44888)
Summary:
Pull Request resolved: #44888
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] [Fixed] - Fix logbox reporting for React errors
Reviewed By: rickhanlonii
Differential Revision: D58441017
fbshipit-source-id: 5355cd04ddcd5238dadbfcbd64fe1f43c8cd04dc
'Warning: Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',
131
+
'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',
132
132
message: {
133
133
content:
134
-
'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.',
134
+
'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',
171
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s',
172
172
message: {
173
173
content:
174
-
'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)`.',
174
+
'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)`.',
175
175
substitutions: [
176
176
{
177
177
length: 52,
178
-
offset: 129,
178
+
offset: 120,
179
179
},
180
180
],
181
181
},
@@ -805,7 +805,7 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
805
805
it('detects a component stack in an interpolated warning',()=>{
806
806
expect(
807
807
parseLogBoxLog([
808
-
'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s%s',
808
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s%s',
809
809
'\n\nCheck the render method of `MyComponent`.',
810
810
'\n in MyComponent (created by MyOtherComponent)\n in MyOtherComponent (created by MyComponent)\n in MyAppComponent (created by MyOtherComponent)',
811
811
]),
@@ -829,14 +829,14 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
829
829
},
830
830
],
831
831
category:
832
-
'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s',
832
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s',
833
833
message: {
834
834
content:
835
-
'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`.',
835
+
'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`.',
836
836
substitutions: [
837
837
{
838
838
length: 43,
839
-
offset: 129,
839
+
offset: 120,
840
840
},
841
841
],
842
842
},
@@ -911,7 +911,7 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
911
911
it('detects a component stack in the nth argument',()=>{
912
912
expect(
913
913
parseLogBoxLog([
914
-
'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',
914
+
'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.%s',
915
915
'\n\nCheck the render method of `MyOtherComponent`.',
916
916
'',
917
917
'\n in MyComponent (created by MyOtherComponent)\n in MyOtherComponent (created by MyComponent)\n in MyAppComponent (created by MyOtherComponent)',
@@ -936,18 +936,18 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
936
936
},
937
937
],
938
938
category:
939
-
'Warning: Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',
939
+
'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',
940
940
message: {
941
941
content:
942
-
'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.',
942
+
'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.',
943
943
substitutions: [
944
944
{
945
945
length: 48,
946
-
offset: 62,
946
+
offset: 53,
947
947
},
948
948
{
949
949
length: 0,
950
-
offset: 110,
950
+
offset: 101,
951
951
},
952
952
],
953
953
},
@@ -1080,7 +1080,7 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
1080
1080
it('detects a component stack in an interpolated warning',()=>{
1081
1081
expect(
1082
1082
parseLogBoxLog([
1083
-
'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s%s',
1083
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s%s',
1084
1084
'\n\nCheck the render method of `MyComponent`.',
1085
1085
'\n at MyComponent (/path/to/filename.js:1:2)\n at MyOtherComponent\n at MyAppComponent (/path/to/app.js:100:20)',
1086
1086
]),
@@ -1103,14 +1103,14 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
1103
1103
},
1104
1104
],
1105
1105
category:
1106
-
'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s',
1106
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s',
1107
1107
message: {
1108
1108
content:
1109
-
'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`.',
1109
+
'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`.',
1110
1110
substitutions: [
1111
1111
{
1112
1112
length: 43,
1113
-
offset: 129,
1113
+
offset: 120,
1114
1114
},
1115
1115
],
1116
1116
},
@@ -1183,7 +1183,7 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
1183
1183
it('detects a component stack in the nth argument',()=>{
1184
1184
expect(
1185
1185
parseLogBoxLog([
1186
-
'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',
1186
+
'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.%s',
1187
1187
'\n\nCheck the render method of `MyOtherComponent`.',
1188
1188
'',
1189
1189
'\n at MyComponent (/path/to/filename.js:1:2)\n at MyOtherComponent\n at MyAppComponent (/path/to/app.js:100:20)',
@@ -1207,18 +1207,18 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
1207
1207
},
1208
1208
],
1209
1209
category:
1210
-
'Warning: Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',
1210
+
'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',
1211
1211
message: {
1212
1212
content:
1213
-
'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.',
1213
+
'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.',
1214
1214
substitutions: [
1215
1215
{
1216
1216
length: 48,
1217
-
offset: 62,
1217
+
offset: 53,
1218
1218
},
1219
1219
{
1220
1220
length: 0,
1221
-
offset: 110,
1221
+
offset: 101,
1222
1222
},
1223
1223
],
1224
1224
},
@@ -1289,7 +1289,7 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
1289
1289
it('detects a component stack in an interpolated warning',()=>{
1290
1290
expect(
1291
1291
parseLogBoxLog([
1292
-
'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s%s',
1292
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s%s',
@@ -1316,14 +1316,14 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
1316
1316
},
1317
1317
],
1318
1318
category:
1319
-
'Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s',
1319
+
'Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s',
1320
1320
message: {
1321
1321
content:
1322
-
'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`.',
1322
+
'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`.',
1323
1323
substitutions: [
1324
1324
{
1325
1325
length: 43,
1326
-
offset: 129,
1326
+
offset: 120,
1327
1327
},
1328
1328
],
1329
1329
},
@@ -1488,7 +1488,7 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
1488
1488
it('detects a component stack in the nth argument',()=>{
1489
1489
expect(
1490
1490
parseLogBoxLog([
1491
-
'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',
1491
+
'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.%s',
1492
1492
'\n\nCheck the render method of `MyOtherComponent`.',
@@ -1516,18 +1516,18 @@ Please follow the instructions at: fburl.com/rn-remote-assets`,
1516
1516
},
1517
1517
],
1518
1518
category:
1519
-
'Warning: Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',
1519
+
'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',
1520
1520
message: {
1521
1521
content:
1522
-
'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.',
1522
+
'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