-
Notifications
You must be signed in to change notification settings - Fork 23
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
Proposed rule: don't use hashCode
in the item key for Lazy* Composables
#374
Comments
PR welcome! |
@yogurtearl do you have a mechanism in mind to statically predict/decide if a type has a valid hashcode? |
Proposing it should just always issue a warning if As Compose docs say that item keys must be unique and LazyColumn/Row throw an exception if it detects a non-unique hashcode and hashcodes are generally never guaranteed to be unique (by design) so it is never a good choice for an Might work just fine until some day data from the server comes along with a dup hashcode and starts causing crashes. Should instead find some other unique thing to use, an ID from the server, or |
Proposed rule: don't use hashCode in the item key for Lazy* Composables
Item key should be unique.
.hashCode()
is not unique.e.g. these all have the same hash code, even on JS, WASM, etc, same hashcode is unlikely, but not impossible in the wild.
The text was updated successfully, but these errors were encountered: