Entity equality check only includes type and id
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 5.8k
- Forks
- 318
- PR merge metrics
- No merged PRs in 30d
Description
If I'm reading the code correctly, only type and entity id are being checked when testing entity equality.
The problem with this approach is you can have the same entity from different db's which has different attributes, yet those entities test as equal.
Per the Datomic documentation:
Two entities are equal if they have the same id and their databases have the same id
I think that's reasonable as long as the db check is fairly cheap. It keeps you from having to realize all attributes to do the check, yet still lets you know that the entities aren't guaranteed to have equal attributes.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/datascript/impl/entity.cljs at lines 85-90 and read the linked Datomic equality guidance. Confirm the current equality behavior for entities with the same id from different databases, then update it so equality distinguishes their database identity while preserving equality for entities from the same database.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100