Migrate usage of the Hash trait for cache invalidation to the dedicated CacheHash trait (#4051)

* WIP start migrating usages of hash for cache invalidadion to dedicated trait

* Finish migrating usages

* Code review

* Add comments clearifying the reasoning for using random ids in the VectorModification cach hash impl

* Fix some remaining hash violations

* Finish migration and fix compilation

* Fix import ordering

* Cleanup

* Fix code review stuff

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Dennis Kobert
2026-04-27 05:18:47 +00:00
committed by GitHub
co-authored by Keavon Chambers
parent 7bb01c9651
commit 3d84e63ef9
64 changed files with 828 additions and 448 deletions
@@ -1,6 +1,5 @@
use graph_craft::document::NodeNetwork;
use std::cell::Cell;
use std::hash::{Hash, Hasher};
#[derive(Debug, Default, Clone, PartialEq)]
pub struct MemoNetwork {
@@ -26,9 +25,9 @@ impl serde::Serialize for MemoNetwork {
}
}
impl Hash for MemoNetwork {
fn hash<H: Hasher>(&self, state: &mut H) {
self.current_hash().hash(state);
impl graphene_hash::CacheHash for MemoNetwork {
fn cache_hash<H: ::core::hash::Hasher>(&self, state: &mut H) {
self.current_hash().cache_hash(state);
}
}
@@ -26,7 +26,7 @@ pub struct GradientOptions {
#[impl_message(Message, ToolMessage, Gradient)]
#[cfg_attr(feature = "wasm", derive(tsify::Tsify))]
#[derive(PartialEq, Clone, Debug, Hash, serde::Serialize, serde::Deserialize)]
#[derive(PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub enum GradientToolMessage {
// Standard messages
Abort,