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

Missing key when using rc-animate #615

Closed
dignifiedquire opened this issue Mar 29, 2017 · 12 comments
Closed

Missing key when using rc-animate #615

dignifiedquire opened this issue Mar 29, 2017 · 12 comments
Labels

Comments

@dignifiedquire
Copy link

It seems there is some difference between React and Preact when using rc-animate. It seems similar to #155 but still appears in the latest version.

I have been using https://github.com/react-component/collapse without issues (following the simple example in the readme) with React, but when switching over to Preact I get the following error thrown

screen shot 2017-03-29 at 23 43 17

screen shot 2017-03-29 at 23 44 16

The key is not explicitly set here it seems: https://github.com/react-component/collapse/blob/master/src/Panel.jsx#L63 but I am guessing for single elements React sets the key automatically?

@developit
Copy link
Member

Hmm, that's quite odd, I can't think of a reason why React would be needing to set a key automatically. Maybe it defaults to numeric?

@dignifiedquire
Copy link
Author

What's also interesting is that, even if I manually a key it doesn' throw anymore but the animation is actually not happening anymore.

@developit
Copy link
Member

Hey @dignifiedquire - this is fixed by @hassanbazzi's work in #629. Working to release 8.1.0 with that fix today.

@dignifiedquire
Copy link
Author

@developit great to hear thank you! I will try it out once its out asap

@developit
Copy link
Member

developit commented Apr 9, 2017

Should be fixed in 8.1.0, let me know if you're able to test it out :)

@dignifiedquire
Copy link
Author

I am afraid the error persists with 8.1.0, exact same issue as originally posted

@hassanbazzi
Copy link
Member

It seems fixed to me. Are you sure you upgraded? Can you provide the error?

@thysultan
Copy link

React sets keys to preserve order, i.e when conditionally rendering between null, int keys might conflict with user keys when some keys are set and some aren't, maybe floating point ints. In this case i think the error is from rc-animate and not React, the lib is validating that children indeed do have keys and since react auto inserts keys when omitted it works with React.

@developit
Copy link
Member

developit commented Apr 10, 2017

Ah yeah, sounds like we were following a red herring. We'll need preact-compat to emulate the default integer key behavior (which makes me sad).

@dignifiedquire
Copy link
Author

I run into yet another issue with the joys of libraries depending on reacts behaviour for how the children methods behave, so I started work implementing them here: preactjs/preact-compat#400

@amareshb
Copy link

I encountered this issue while rendering select tags with "" as value and "None" as display properties.
I don't see the issue when I replace the "" value with "none" (some random value).

Please tell me, if there is a better work around.

@JoviDeCroock
Copy link
Member

Let's track this in #3403

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants