Skip to content
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

Just warn on clashing keys but proceed with render #566

Closed
sophiebits opened this issue Nov 19, 2013 · 3 comments · Fixed by #1364
Closed

Just warn on clashing keys but proceed with render #566

sophiebits opened this issue Nov 19, 2013 · 3 comments · Fixed by #1364

Comments

@sophiebits
Copy link
Collaborator

We've hit a couple bugs in prod now where keys are supposed to be distinct but aren't, which causes React to throw errors and render nothing.

It would be nice if React could instead warn and render all the components anyway (perhaps adding some suffix to make the keys unique) or render only one of the components with the same ID. Both of these seem preferable to completely dying (though maybe this is just our fault for not properly having our JS error reporting figured out…).

@plievone
Copy link
Contributor

plievone commented Jan 3, 2014

Because keys are optional, it should indeed just warn in prod, not break. But perhaps uniqueness is relied on in too many places to handle a special case of invalid keys nicely?

@sophiebits
Copy link
Collaborator Author

The fact that keys are optional has nothing to do with this. React should have the same behavior in dev and prod but it's perfectly reasonable to throw (as now) or warn.

@plievone
Copy link
Contributor

plievone commented Jan 5, 2014

@spicyj Sorry I meant that as an api user one could assume that keys are just to help react in reusing component instances and if one supplies invalid keys then one could assume that then they are just no help and slower way proceeds. So I support your cause :)

@sophiebits sophiebits changed the title RFC: Perhaps just warn on clashing keys but proceed with render Just warn on clashing keys but proceed with render Apr 3, 2014
sophiebits added a commit to sophiebits/react that referenced this issue Apr 7, 2014
@zpao zpao closed this as completed in #1364 Apr 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants