-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Unnecessary deep cloning of props causes comparisons with === to fail #6262
Comments
After digging through the code, I believe this may fix the issue. File Commands.ts But I don't understand the rationale of cloning the props. I see that the Also, on file ComponentWrapper.tsx, line 31, instead of using lodash's |
Maybe there is a reason behind this (@guyca)? , if not I think it's better to we remove it ? I had a problem with this as well and I had to spend some time to find out using |
In my humble opinion, there's no need to do deep cloning, since React doesn't do that for you....the more similar this library is to React, the better. |
I don't think it's good to rely on |
Guys, I'm not sure if it is worth changing the current behaviour of the library as there are multiple ways for the consumer to be checking the equality of the objects. @HectorRicardo you could simply do Also as @jfrolich suggested, it would be a better practice to be comparing a unique property than an entire object. Closing the issue for now as I don't see an immediate benefit but feel free to provide feedback if this must be implemented. |
updateProps deep cloned props thus rendering instance comparisons useless. closes #6262
Issue Description
Apparently, when using Navigation.updateProps(), the props passed as parameter are deep cloned. This causes shallow comparisons with '===' to fail inside the children components. I don't expect this behavior, because React does not deep clone properties automatically for you (see example).
Steps to Reproduce / Code Snippets / Screenshots
Repository: https://github.com/HectorRicardo/deepCloneBug
index.js:
App.js
Environment
The text was updated successfully, but these errors were encountered: