Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update warning message
  • Loading branch information
sebmarkbage committed Oct 12, 2018
commit 42caeed8619db1b09ece18835c4133db6afe8c20
9 changes: 4 additions & 5 deletions packages/react-dom/src/__tests__/findDOMNode-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,8 @@ describe('findDOMNode', () => {
let match;
expect(() => (match = ReactDOM.findDOMNode(parent))).toWarnDev([
'Warning: findDOMNode is deprecated in StrictMode. ' +
'findDOMNode was passed an instance of ContainsStrictModeChild which renders a StrictMode subtree. ' +
'The nearest child is in StrictMode. ' +
'Use an explicit ref directly on the element you want to get a handle on.' +
'findDOMNode was passed an instance of ContainsStrictModeChild which renders a StrictMode children. ' +
'Instead, add a ref directly to the element you want to reference.' +
'\n' +
'\n in div (at **)' +
'\n in StrictMode (at **)' +
Expand Down Expand Up @@ -152,8 +151,8 @@ describe('findDOMNode', () => {
let match;
expect(() => (match = ReactDOM.findDOMNode(parent))).toWarnDev([
'Warning: findDOMNode is deprecated in StrictMode. ' +
'findDOMNode was passed an instance of IsInStrictMode which is in a StrictMode subtree. ' +
'Use an explicit ref directly on the element you want to get a handle on.' +
'findDOMNode was passed an instance of IsInStrictMode which is inside StrictMode. ' +
'Instead, add a ref directly to the element you want to reference.' +
'\n' +
'\n in IsInStrictMode (at **)' +
'\n in StrictMode (at **)' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,8 @@ describe('ReactFabric', () => {
let match;
expect(() => (match = ReactFabric.findNodeHandle(parent))).toWarnDev([
'Warning: findNodeHandle is deprecated in StrictMode. ' +
'findNodeHandle was passed an instance of ContainsStrictModeChild which renders a StrictMode subtree. ' +
'The nearest child is in StrictMode. ' +
'Use an explicit ref directly on the element you want to get a handle on.' +
'findNodeHandle was passed an instance of ContainsStrictModeChild which renders a StrictMode children. ' +
'Instead, add a ref directly to the element you want to reference.' +
'\n' +
'\n in RCTView (at **)' +
'\n in StrictMode (at **)' +
Expand Down Expand Up @@ -502,8 +501,8 @@ describe('ReactFabric', () => {
let match;
expect(() => (match = ReactFabric.findNodeHandle(parent))).toWarnDev([
'Warning: findNodeHandle is deprecated in StrictMode. ' +
'findNodeHandle was passed an instance of IsInStrictMode which is in a StrictMode subtree. ' +
'Use an explicit ref directly on the element you want to get a handle on.' +
'findNodeHandle was passed an instance of IsInStrictMode which is inside StrictMode. ' +
'Instead, add a ref directly to the element you want to reference.' +
'\n' +
'\n in IsInStrictMode (at **)' +
'\n in StrictMode (at **)' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,8 @@ describe('ReactNative', () => {
let match;
expect(() => (match = ReactNative.findNodeHandle(parent))).toWarnDev([
'Warning: findNodeHandle is deprecated in StrictMode. ' +
'findNodeHandle was passed an instance of ContainsStrictModeChild which renders a StrictMode subtree. ' +
'The nearest child is in StrictMode. ' +
'Use an explicit ref directly on the element you want to get a handle on.' +
'findNodeHandle was passed an instance of ContainsStrictModeChild which renders a StrictMode children. ' +
'Instead, add a ref directly to the element you want to reference.' +
'\n' +
'\n in RCTView (at **)' +
'\n in StrictMode (at **)' +
Expand Down Expand Up @@ -324,8 +323,8 @@ describe('ReactNative', () => {
let match;
expect(() => (match = ReactNative.findNodeHandle(parent))).toWarnDev([
'Warning: findNodeHandle is deprecated in StrictMode. ' +
'findNodeHandle was passed an instance of IsInStrictMode which is in a StrictMode subtree. ' +
'Use an explicit ref directly on the element you want to get a handle on.' +
'findNodeHandle was passed an instance of IsInStrictMode which is inside StrictMode. ' +
'Instead, add a ref directly to the element you want to reference.' +
'\n' +
'\n in IsInStrictMode (at **)' +
'\n in StrictMode (at **)' +
Expand Down
9 changes: 4 additions & 5 deletions packages/react-reconciler/src/ReactFiberReconciler.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ function findHostInstanceWithWarning(
warningWithoutStack(
false,
'%s is deprecated in StrictMode. ' +
'%s was passed an instance of %s which is in a StrictMode subtree. ' +
'Use an explicit ref directly on the element you want to get a handle on.' +
'%s was passed an instance of %s which is inside StrictMode. ' +
'Instead, add a ref directly to the element you want to reference.' +
'\n%s' +
'\n\nLearn more about using refs safely here:' +
'\nhttps://fb.me/react-strict-mode-find-node',
Expand All @@ -256,9 +256,8 @@ function findHostInstanceWithWarning(
warningWithoutStack(
false,
'%s is deprecated in StrictMode. ' +
'%s was passed an instance of %s which renders a StrictMode subtree. ' +
'The nearest child is in StrictMode. ' +
'Use an explicit ref directly on the element you want to get a handle on.' +
'%s was passed an instance of %s which renders a StrictMode children. ' +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"a StrictMode children" sounds odd, maybe drop "a"?

'Instead, add a ref directly to the element you want to reference.' +
'\n%s' +
'\n\nLearn more about using refs safely here:' +
'\nhttps://fb.me/react-strict-mode-find-node',
Expand Down