-
Notifications
You must be signed in to change notification settings - Fork 47.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relax validateDOMNesting warning for whitespace in table #6995
Comments
Yah. I'm torn, considering we mostly validate for invalid nesting and not to be strict it seems fine to just let it through even though it's useless. However, non-whitespace strings are not allowed there and will break SSR. |
@syranide I don't understand, why are you torn? This issue is only about whitespace, which is always safe, even with SSR, right? |
@jimfb Yeah, it's safe, but it's also useless and there's virtually no reason for it to exist there. So warning could be a good thing too. It isn't really a big deal though, this is very much an edge-case, but still. |
Thank for opening this ticket for/because of me, but I think the warning is not too bad actually. What if someone tries writing something like: <tr>{someString}</tr> Now the warning would be suppressed if However, empty strings are falsey so avoiding the warning in situations such as I had, <tr>{someString && <td/>}</tr> Would actually be beneficial. But it's also not too hard for me to amend that code to make sure Also, if it's going to create these |
I'd be interested in taking a stab at fixing this. I'll have a PR up later this week. |
For what it's worth, we saw this error when we had a comment at the end of a line in the
The space between the title tag and the JS expression comment throws the error. Easily fixed, but it was a bit surprising. |
@joshhunt Ah, that's part of the JSX parsing rules. If you replace your comment (which is actually an empty expression) with a string it makes a lot more sense, same rules apply. |
Yeah I got that - I figured an extra space char wound up in the generated response, but I figured there's nothing wrong with white space in the head tag and would fall under this issue? |
Going to give this a go. |
Is this still active ? I can give a try if not :) |
@wallacyyy there's an open PR for this at #7081 |
Fixed in #7515. |
@aweary I know, just asked because the last interaction was 2 months ago, so maybe the PR could not been active anymore :) Thx for the reply ! |
See #5071 (comment) -- since we stopped wrapping text in spans, we should loosen the validation in validateDOMNesting a little. I think it should probably be fine to have whitespace anywhere in the tree?
The text was updated successfully, but these errors were encountered: