-
Notifications
You must be signed in to change notification settings - Fork 48.5k
Resolving implicit thead can lead to invariant violation #2005
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
Comments
Yes, that's why the error tells you to add |
We can error at an earlier time already, we just need to remove the "smart code". We will never be able to error earlier than that, the only way to error earlier than that is with immediate traversal (in dev only perhaps, we can do that today if we want), but even that is not 100% fool-proof for all edge-cases I'm pretty sure (if the DOM is detached or later moved). Personally I would prefer that it errors as soon as possible, rather than as late as possible. The harder it is for an error to surface, the more likely it is to make it into PROD. |
I agree in principle but am also wary of causing unnecessary churn, especially if it turns out we can add the tbody automatically in the future, which I would like to do. I am fine with adding a dev-only warning() call now telling you to add a tbody though. |
In some ways I'm aware of the "service" we would be providing if we made But regardless of where I stand on that, I don't see how we could ever provide a reliable implementation. There are so many edge-cases, including some that we simply cannot account for. It's a nice idea to transparently add a <table><thead>...</thead><tr><td></td></tr></table>
<table><tbody>...</tbody><tr><td></td></tr></table>
<table><tr><td></td></tr><thead>...</thead></table> The only lenient and robust solution I can imagine is only accepting |
The fiddle doesn’t work for me anymore, and last comment was several years ago. We do warn about bad nesting now, so hopefully this should not be a problem. |
http://jsfiddle.net/9Q2m2/
Internet is more or less unavailable for me right now, so can't test more thoroughly. But thinking about it, it seems that the "blind-jumps" we do now to detect and resolve implicitly added elements (mainly
thead
) appears to not actually be safe as-is. Personally I feel like the solution is to not resolve implicitly added elements at all, but rather tell the user of his/her error instead and have them fix it.Related PR #1987 (Provide a friendly path for reactID errors in ReactMount)
The text was updated successfully, but these errors were encountered: