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

Documentation: Make it clear when the __key argument should be used and when clone should be called #6937

Open
etrepum opened this issue Dec 10, 2024 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@etrepum
Copy link
Collaborator

etrepum commented Dec 10, 2024

Description

It's a common mistake for people to assume that they just pass __key around, but the reality is that you should never ever use __key except when implementing a constructor or clone method.

Another common mistake is to assume that clone is something that can be used to duplicate a node. It's not. It should be considered a private method that is only called internally.

There is some relevant documentation about this $cloneWithProperties and various invariants but people keep running into this so we should add more docs.

@etrepum etrepum added enhancement Improvement over existing feature documentation Improvements or additions to documentation and removed enhancement Improvement over existing feature labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant