Skip to content

Commit e0fe347

Browse files
authored
[flags] remove enableOwnerStacks (#32426)
Bassed off: #32425 Wait to land internally. [Commit to review.](66aa6a4) This has landed everywhere
1 parent d48c692 commit e0fe347

File tree

90 files changed

+1361
-3191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1361
-3191
lines changed

packages/internal-test-utils/__tests__/ReactInternalTestUtils-test.js

Lines changed: 2 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -857,17 +857,6 @@ describe('ReactInternalTestUtils console assertions', () => {
857857
858858
You must call one of the assertConsoleDev helpers between each act call."
859859
`);
860-
} else if (gate(flags => flags.enableOwnerStacks)) {
861-
expect(message).toMatchInlineSnapshot(`
862-
"asserConsoleLogsCleared(expected)
863-
864-
console.log was called without assertConsoleLogDev:
865-
+ Not asserted
866-
+ Not asserted
867-
+ Not asserted
868-
869-
You must call one of the assertConsoleDev helpers between each act call."
870-
`);
871860
} else {
872861
expect(message).toMatchInlineSnapshot(`
873862
"asserConsoleLogsCleared(expected)
@@ -937,20 +926,6 @@ describe('ReactInternalTestUtils console assertions', () => {
937926
+ B
938927
+ C
939928
940-
You must call one of the assertConsoleDev helpers between each act call."
941-
`);
942-
} else if (gate(flags => flags.enableOwnerStacks)) {
943-
expect(message).toMatchInlineSnapshot(`
944-
"asserConsoleLogsCleared(expected)
945-
946-
console.warn was called without assertConsoleWarnDev:
947-
+ A%s,
948-
+ in App (at **)
949-
+ B%s,
950-
+ in App (at **)
951-
+ C%s,
952-
+ in App (at **)
953-
954929
You must call one of the assertConsoleDev helpers between each act call."
955930
`);
956931
} else {
@@ -959,16 +934,10 @@ describe('ReactInternalTestUtils console assertions', () => {
959934
960935
console.warn was called without assertConsoleWarnDev:
961936
+ A%s,
962-
+ in Yield (at **)
963-
+ in div (at **)
964937
+ in App (at **)
965938
+ B%s,
966-
+ in Yield (at **)
967-
+ in div (at **)
968939
+ in App (at **)
969940
+ C%s,
970-
+ in Yield (at **)
971-
+ in div (at **)
972941
+ in App (at **)
973942
974943
You must call one of the assertConsoleDev helpers between each act call."
@@ -1023,33 +992,6 @@ describe('ReactInternalTestUtils console assertions', () => {
1023992
+ B
1024993
+ C
1025994
1026-
You must call one of the assertConsoleDev helpers between each act call."
1027-
`);
1028-
} else if (gate(flags => flags.enableOwnerStacks)) {
1029-
expect(message).toMatchInlineSnapshot(`
1030-
"asserConsoleLogsCleared(expected)
1031-
1032-
console.log was called without assertConsoleLogDev:
1033-
+ A
1034-
+ B
1035-
+ C
1036-
1037-
console.warn was called without assertConsoleWarnDev:
1038-
+ A%s,
1039-
+ in App (at **)
1040-
+ B%s,
1041-
+ in App (at **)
1042-
+ C%s,
1043-
+ in App (at **)
1044-
1045-
console.error was called without assertConsoleErrorDev:
1046-
+ A%s,
1047-
+ in App (at **)
1048-
+ B%s,
1049-
+ in App (at **)
1050-
+ C%s,
1051-
+ in App (at **)
1052-
1053995
You must call one of the assertConsoleDev helpers between each act call."
1054996
`);
1055997
} else {
@@ -1063,30 +1005,18 @@ describe('ReactInternalTestUtils console assertions', () => {
10631005
10641006
console.warn was called without assertConsoleWarnDev:
10651007
+ A%s,
1066-
+ in Yield (at **)
1067-
+ in div (at **)
10681008
+ in App (at **)
10691009
+ B%s,
1070-
+ in Yield (at **)
1071-
+ in div (at **)
10721010
+ in App (at **)
10731011
+ C%s,
1074-
+ in Yield (at **)
1075-
+ in div (at **)
10761012
+ in App (at **)
10771013
10781014
console.error was called without assertConsoleErrorDev:
10791015
+ A%s,
1080-
+ in Yield (at **)
1081-
+ in div (at **)
10821016
+ in App (at **)
10831017
+ B%s,
1084-
+ in Yield (at **)
1085-
+ in div (at **)
10861018
+ in App (at **)
10871019
+ C%s,
1088-
+ in Yield (at **)
1089-
+ in div (at **)
10901020
+ in App (at **)
10911021
10921022
You must call one of the assertConsoleDev helpers between each act call."
@@ -1927,20 +1857,6 @@ describe('ReactInternalTestUtils console assertions', () => {
19271857
+ Not asserted
19281858
+ Not asserted
19291859
1930-
You must call one of the assertConsoleDev helpers between each act call."
1931-
`);
1932-
} else if (gate(flags => flags.enableOwnerStacks)) {
1933-
expect(message).toMatchInlineSnapshot(`
1934-
"asserConsoleLogsCleared(expected)
1935-
1936-
console.warn was called without assertConsoleWarnDev:
1937-
+ Not asserted%s,
1938-
+ in Yield (at **)
1939-
+ Not asserted%s,
1940-
+ in Yield (at **)
1941-
+ Not asserted%s,
1942-
+ in Yield (at **)
1943-
19441860
You must call one of the assertConsoleDev helpers between each act call."
19451861
`);
19461862
} else {
@@ -1950,13 +1866,10 @@ describe('ReactInternalTestUtils console assertions', () => {
19501866
console.warn was called without assertConsoleWarnDev:
19511867
+ Not asserted%s,
19521868
+ in Yield (at **)
1953-
+ in div (at **)
19541869
+ Not asserted%s,
19551870
+ in Yield (at **)
1956-
+ in div (at **)
19571871
+ Not asserted%s,
19581872
+ in Yield (at **)
1959-
+ in div (at **)
19601873
19611874
You must call one of the assertConsoleDev helpers between each act call."
19621875
`);
@@ -2020,7 +1933,7 @@ describe('ReactInternalTestUtils console assertions', () => {
20201933
20211934
You must call one of the assertConsoleDev helpers between each act call."
20221935
`);
2023-
} else if (gate(flags => flags.enableOwnerStacks)) {
1936+
} else {
20241937
expect(message).toMatchInlineSnapshot(`
20251938
"asserConsoleLogsCleared(expected)
20261939
@@ -2034,26 +1947,6 @@ describe('ReactInternalTestUtils console assertions', () => {
20341947
20351948
You must call one of the assertConsoleDev helpers between each act call."
20361949
`);
2037-
} else {
2038-
expect(message).toMatchInlineSnapshot(`
2039-
"asserConsoleLogsCleared(expected)
2040-
2041-
console.error was called without assertConsoleErrorDev:
2042-
+ A%s,
2043-
+ in Yield (at **)
2044-
+ in div (at **)
2045-
+ in App (at **)
2046-
+ B%s,
2047-
+ in Yield (at **)
2048-
+ in div (at **)
2049-
+ in App (at **)
2050-
+ C%s,
2051-
+ in Yield (at **)
2052-
+ in div (at **)
2053-
+ in App (at **)
2054-
2055-
You must call one of the assertConsoleDev helpers between each act call."
2056-
`);
20571950
}
20581951
});
20591952

@@ -2106,7 +1999,7 @@ describe('ReactInternalTestUtils console assertions', () => {
21061999
21072000
You must call one of the assertConsoleDev helpers between each act call."
21082001
`);
2109-
} else if (gate(flags => flags.enableOwnerStacks)) {
2002+
} else {
21102003
expect(message).toMatchInlineSnapshot(`
21112004
"asserConsoleLogsCleared(expected)
21122005
@@ -2133,45 +2026,6 @@ describe('ReactInternalTestUtils console assertions', () => {
21332026
21342027
You must call one of the assertConsoleDev helpers between each act call."
21352028
`);
2136-
} else {
2137-
expect(message).toMatchInlineSnapshot(`
2138-
"asserConsoleLogsCleared(expected)
2139-
2140-
console.log was called without assertConsoleLogDev:
2141-
+ A
2142-
+ B
2143-
+ C
2144-
2145-
console.warn was called without assertConsoleWarnDev:
2146-
+ A%s,
2147-
+ in Yield (at **)
2148-
+ in div (at **)
2149-
+ in App (at **)
2150-
+ B%s,
2151-
+ in Yield (at **)
2152-
+ in div (at **)
2153-
+ in App (at **)
2154-
+ C%s,
2155-
+ in Yield (at **)
2156-
+ in div (at **)
2157-
+ in App (at **)
2158-
2159-
console.error was called without assertConsoleErrorDev:
2160-
+ A%s,
2161-
+ in Yield (at **)
2162-
+ in div (at **)
2163-
+ in App (at **)
2164-
+ B%s,
2165-
+ in Yield (at **)
2166-
+ in div (at **)
2167-
+ in App (at **)
2168-
+ C%s,
2169-
+ in Yield (at **)
2170-
+ in div (at **)
2171-
+ in App (at **)
2172-
2173-
You must call one of the assertConsoleDev helpers between each act call."
2174-
`);
21752029
}
21762030
});
21772031

@@ -3052,20 +2906,6 @@ describe('ReactInternalTestUtils console assertions', () => {
30522906
+ Not asserted
30532907
+ Not asserted
30542908
3055-
You must call one of the assertConsoleDev helpers between each act call."
3056-
`);
3057-
} else if (gate(flags => flags.enableOwnerStacks)) {
3058-
expect(message).toMatchInlineSnapshot(`
3059-
"asserConsoleLogsCleared(expected)
3060-
3061-
console.error was called without assertConsoleErrorDev:
3062-
+ Not asserted%s,
3063-
+ in Yield (at **)
3064-
+ Not asserted%s,
3065-
+ in Yield (at **)
3066-
+ Not asserted%s,
3067-
+ in Yield (at **)
3068-
30692909
You must call one of the assertConsoleDev helpers between each act call."
30702910
`);
30712911
} else {
@@ -3075,13 +2915,10 @@ describe('ReactInternalTestUtils console assertions', () => {
30752915
console.error was called without assertConsoleErrorDev:
30762916
+ Not asserted%s,
30772917
+ in Yield (at **)
3078-
+ in div (at **)
30792918
+ Not asserted%s,
30802919
+ in Yield (at **)
3081-
+ in div (at **)
30822920
+ Not asserted%s,
30832921
+ in Yield (at **)
3084-
+ in div (at **)
30852922
30862923
You must call one of the assertConsoleDev helpers between each act call."
30872924
`);

packages/internal-test-utils/consoleMock.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
/* eslint-disable react-internal/no-production-logging */
9+
910
const chalk = require('chalk');
1011
const util = require('util');
1112
const shouldIgnoreConsoleError = require('./shouldIgnoreConsoleError');
@@ -38,25 +39,16 @@ const patchConsoleMethod = (methodName, logged) => {
3839
(methodName === 'error' || methodName === 'warn')
3940
) {
4041
const React = require('react');
42+
43+
// Ideally we could remove this check, but we have some tests like
44+
// useSyncExternalStoreShared-test that tests against React 17,
45+
// which doesn't have the captureOwnerStack method.
4146
if (React.captureOwnerStack) {
42-
// enableOwnerStacks enabled. When it's always on, we can assume this case.
4347
const stack = React.captureOwnerStack();
4448
if (stack) {
4549
format += '%s';
4650
args.push(stack);
4751
}
48-
} else {
49-
// Otherwise we have to use internals to emulate parent stacks.
50-
const ReactSharedInternals =
51-
React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE ||
52-
React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
53-
if (ReactSharedInternals && ReactSharedInternals.getCurrentStack) {
54-
const stack = ReactSharedInternals.getCurrentStack();
55-
if (stack !== '') {
56-
format += '%s';
57-
args.push(stack);
58-
}
59-
}
6052
}
6153
}
6254

packages/react-cache/src/__tests__/ReactCacheOld-test.internal.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,7 @@ describe('ReactCache', () => {
203203
"boolean, but instead received: [ 'Hi', 100 ]\n\n" +
204204
'To use non-primitive values as keys, you must pass a hash ' +
205205
'function as the second argument to createResource().\n' +
206-
' in App (at **)' +
207-
(gate(flags => flags.enableOwnerStacks)
208-
? ''
209-
: '\n in Suspense (at **)'),
210-
206+
' in App (at **)',
211207
...(gate('enableSiblingPrerendering')
212208
? [
213209
'Invalid key type. Expected a string, number, symbol, or ' +

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy