Skip to content

Commit 065c2cf

Browse files
committed
Add comments clearifying the reasoning for using random ids in the VectorModification cach hash impl
1 parent 060e5a2 commit 065c2cf

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

node-graph/libraries/vector-types/src/vector/vector_modification.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ pub struct PointModification {
1717
delta: HashMap<PointId, DVec2>,
1818
}
1919

20-
impl Hash for PointModification {
21-
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
22-
generate_uuid().hash(state)
23-
}
24-
}
25-
2620
impl PointModification {
2721
/// Apply this modification to the specified [`PointDomain`].
2822
pub fn apply(&self, point_domain: &mut PointDomain, segment_domain: &mut SegmentDomain) {
@@ -511,14 +505,10 @@ impl VectorModification {
511505
}
512506
}
513507

514-
impl Hash for VectorModification {
515-
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
516-
generate_uuid().hash(state)
517-
}
518-
}
519-
520508
// Intentionally non-deterministic: fields contain HashMaps with non-deterministic iteration order,
521-
// so we use a UUID to always bust the cache and force re-evaluation when any modification is present
509+
// so we use a UUID to always bust the cache and force re-evaluation when any modification is present.
510+
// This will not actually lead to a cache invalidation in most cases due to the
511+
// graph inputs being wrapped in a `MemoHash` wrapper.
522512
impl graphene_hash::CacheHash for VectorModification {
523513
fn cache_hash<H: core::hash::Hasher>(&self, state: &mut H) {
524514
core::hash::Hash::hash(&generate_uuid(), state);

0 commit comments

Comments
 (0)