-
Notifications
You must be signed in to change notification settings - Fork 59
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
Not using keys with JSX Metal Components produces strange behavior #107
Comments
Thanks for reporting, will investigate. |
I figured out why this is happening, it's actually a bug in the app code, not in the infra (though it would be nice to make it easier to debug things like this, no idea right now but I'll think about it). This is happening because you're overriding the constructor, but you're calling Also, from what I saw the reason why you're overriding the constructor is to bind the functions you'll be using inside By changing this for both As I said, I'll try to find of a way to try to make these kind of problems clearer. |
Thanks Maira, that makes sense. Will use the created to bind functions. |
Sure, if all works as expected with these changes let me know so we can close this :) |
I'll close this since from what you told me this is working fine now :) Just FYI, the other issue you mentioned with keys is being tracked by mairatma/metal-incremental-dom#6. |
@AngeloYoun FYI, a general good policy if you do need to overwrite the constructor (whether in Metal, or React) is to do: constructor(...args) {
super(...args);
} And even if you need some named ones, you can always use the spread operator to pass along any you're not aware of :) |
There seems to be an issue when not using keys for metal-jsx. This component is supposed to be adding more inputs but instead adds duplicate copies of itself when the 'Add Filter' button is clicked.
Manually setting keys to the components resolves this issue.
https://github.com/AngeloYoun/liferay-plugins-ee/blob/ZOE-177/portlets/watson-portlet/docroot/js/src/components/dynamic_select_input.js
The text was updated successfully, but these errors were encountered: