Include component stack in more places, including SSR#11284
Include component stack in more places, including SSR#11284gaearon merged 5 commits intofacebook:masterfrom
Conversation
| ); | ||
| }); | ||
|
|
||
| it('should include owner rather than parent in warnings', () => { |
There was a problem hiding this comment.
Removed this test since it's not really useful in component stacks (where we have both).
Would be nice to mark owner in some special way in stacks but that's a separate issue.
| }); | ||
|
|
||
| it('should warn for children on void elements', () => { | ||
| it('should throw for children on void elements', () => { |
There was a problem hiding this comment.
Just describing what it really tested for.
| ); | ||
| }); | ||
|
|
||
| it('should warn about contentEditable and children', () => { |
There was a problem hiding this comment.
Not new behavior, but we didn't have an SSR test for it.
bvaughn
left a comment
There was a problem hiding this comment.
I think this looks good 😄
| getStackAddendum = function(): null | string { | ||
| if (currentDebugStack === null) { | ||
| return null; | ||
| return ''; |
There was a problem hiding this comment.
I'm curious: Why the change from null => ''?
(Is it to maintain the previous behavior where we had an inline function just returning an empty string?)
There was a problem hiding this comment.
Because we use getStack() directly as %s, which would show up as null right in the message when missing. I agree it's not great though and would be nice to fix the whole thing by adding a separate warningWithStack or something.
There was a problem hiding this comment.
Ah. Gotcha.
I asked b'c the Flow return type is also null | string but it's no big deal 😄
| }); | ||
|
|
||
| it('should warn for children on void elements', () => { | ||
| it('should throw for children on void elements', () => { |
| props: ?Object, | ||
| getStack: () => string, | ||
| ) { | ||
| function assertValidProps(tag: string, props: ?Object, getStack: () => string) { |
This includes component stack instead of owner name in more places, including previously TODO'd places in the server renderer. It also gets rid of the last SSR dependency on reconciler modules so I could remove
react-reconciler/*from the source whitelist for SSR bundles.