Skip to content

Commit 436f30c

Browse files
committed
Add component stack to all hydrate mismatch warnings in react-dom
1 parent 03e5754 commit 436f30c

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ describe('ReactDOMServerHydration', () => {
274274
'Warning: Prop `style` did not match. Server: ' +
275275
'"text-decoration:none;color:black;height:10px" Client: ' +
276276
'"text-decoration:none;color:white;height:10px"',
277-
{withoutStack: true},
278277
);
279278
});
280279

@@ -322,7 +321,6 @@ describe('ReactDOMServerHydration', () => {
322321
'Warning: Prop `style` did not match. Server: ' +
323322
'"text-decoration: none; color: black; height: 10px;" Client: ' +
324323
'"text-decoration:none;color:black;height:10px"',
325-
{withoutStack: true},
326324
);
327325
});
328326

packages/react-dom/src/client/ReactDOMComponent.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {getCurrentFiberOwnerNameInDevOrNull} from 'react-reconciler/src/ReactCur
1212
import {registrationNameModules} from 'events/EventPluginRegistry';
1313
import warning from 'shared/warning';
1414
import {canUseDOM} from 'shared/ExecutionEnvironment';
15-
import warningWithoutStack from 'shared/warningWithoutStack';
1615
import type {ReactEventResponderEventType} from 'shared/ReactTypes';
1716
import type {DOMTopLevelEventType} from 'events/TopLevelEventTypes';
1817
import {setListenToResponderEventTypes} from '../events/DOMEventResponderSystem';
@@ -176,7 +175,7 @@ if (__DEV__) {
176175
return;
177176
}
178177
didWarnInvalidHydration = true;
179-
warningWithoutStack(
178+
warning(
180179
false,
181180
'Text content did not match. Server: "%s" Client: "%s"',
182181
normalizedServerText,
@@ -202,7 +201,7 @@ if (__DEV__) {
202201
return;
203202
}
204203
didWarnInvalidHydration = true;
205-
warningWithoutStack(
204+
warning(
206205
false,
207206
'Prop `%s` did not match. Server: %s Client: %s',
208207
propName,
@@ -220,7 +219,7 @@ if (__DEV__) {
220219
attributeNames.forEach(function(name) {
221220
names.push(name);
222221
});
223-
warningWithoutStack(false, 'Extra attributes from the server: %s', names);
222+
warning(false, 'Extra attributes from the server: %s', names);
224223
};
225224

226225
warnForInvalidEventListener = function(registrationName, listener) {
@@ -1189,7 +1188,7 @@ export function warnForDeletedHydratableElement(
11891188
return;
11901189
}
11911190
didWarnInvalidHydration = true;
1192-
warningWithoutStack(
1191+
warning(
11931192
false,
11941193
'Did not expect server HTML to contain a <%s> in <%s>.',
11951194
child.nodeName.toLowerCase(),
@@ -1207,7 +1206,7 @@ export function warnForDeletedHydratableText(
12071206
return;
12081207
}
12091208
didWarnInvalidHydration = true;
1210-
warningWithoutStack(
1209+
warning(
12111210
false,
12121211
'Did not expect server HTML to contain the text node "%s" in <%s>.',
12131212
child.nodeValue,
@@ -1226,7 +1225,7 @@ export function warnForInsertedHydratedElement(
12261225
return;
12271226
}
12281227
didWarnInvalidHydration = true;
1229-
warningWithoutStack(
1228+
warning(
12301229
false,
12311230
'Expected server HTML to contain a matching <%s> in <%s>.',
12321231
tag,
@@ -1251,7 +1250,7 @@ export function warnForInsertedHydratedText(
12511250
return;
12521251
}
12531252
didWarnInvalidHydration = true;
1254-
warningWithoutStack(
1253+
warning(
12551254
false,
12561255
'Expected server HTML to contain a matching text node for "%s" in <%s>.',
12571256
text,

0 commit comments

Comments
 (0)