-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Add more detail to missing-key warning #6163
Comments
The same goes for the |
Could you post a plunker or gist with the source example that contains the DOM to which you would want the above warnings to result? |
I believe that a recreation of the issue would be in the following fiddle: https://jsfiddle.net/c8bxbjwv/. You can see that both "hello" and "world" render, but the world is the invalid element as it doesn't have a key, but the error doesn't display that. I have created an attempt at fixing this with Pull Request #6317. Please let me know your thoughts |
So, given that fiddle, what would the warning text be? |
Currently I have a basic warning,
We need to expand on it to cover edge cases, it currently isn't descriptive enough. For example if we have multiple divs with world as text it doesn't distinguish which one is the culprit. |
Cool, that would be helpful info. |
This was fixed in https://github.com/facebook/react/pull/6799—now we have an exact stack trace. |
I have a component in which I must be using an array and not setting keys because I get this warning:
The problem is that render methods aren't always simple and sometimes it's quite hard to find out where the problematic array is.
It would be awesome it the warning could be enhanced to provide some more information about the problematic dom. Something like:
or even
The text was updated successfully, but these errors were encountered: