From 89c9cf13525a205a90178159b135a83e0aa58843 Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Fri, 5 Sep 2025 14:04:10 -0700 Subject: [PATCH] Fix infinite recursion introduced in #2795 that occurs in old document migrations --- .../document/utility_types/network_interface.rs | 17 +---------------- .../network_interface/deserialization.rs | 8 +++++++- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/editor/src/messages/portfolio/document/utility_types/network_interface.rs b/editor/src/messages/portfolio/document/utility_types/network_interface.rs index fd86ebe2..52cae9b6 100644 --- a/editor/src/messages/portfolio/document/utility_types/network_interface.rs +++ b/editor/src/messages/portfolio/document/utility_types/network_interface.rs @@ -6649,7 +6649,7 @@ struct InputTransientMetadata { } /// Persistent metadata for each node in the network, which must be included when creating, serializing, and deserializing saving a node. -#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] +#[derive(Default, Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] pub struct DocumentNodePersistentMetadata { /// The name of the node definition, as originally set by [`DocumentNodeDefinition`], used to display in the UI and to display the appropriate properties if no display name is set. // TODO: Used during serialization/deserialization to prevent storing implementation or inputs (and possible other fields) if they are the same as the definition. @@ -6676,21 +6676,6 @@ pub struct DocumentNodePersistentMetadata { pub network_metadata: Option, } -impl Default for DocumentNodePersistentMetadata { - fn default() -> Self { - DocumentNodePersistentMetadata { - reference: None, - display_name: String::new(), - input_metadata: Vec::new(), - output_names: Vec::new(), - pinned: false, - locked: false, - node_type_metadata: NodeTypePersistentMetadata::default(), - network_metadata: None, - } - } -} - impl DocumentNodePersistentMetadata { pub fn is_layer(&self) -> bool { matches!(self.node_type_metadata, NodeTypePersistentMetadata::Layer(_)) diff --git a/editor/src/messages/portfolio/document/utility_types/network_interface/deserialization.rs b/editor/src/messages/portfolio/document/utility_types/network_interface/deserialization.rs index 3b416713..c1099a0f 100644 --- a/editor/src/messages/portfolio/document/utility_types/network_interface/deserialization.rs +++ b/editor/src/messages/portfolio/document/utility_types/network_interface/deserialization.rs @@ -23,7 +23,13 @@ impl From for DocumentNodePersistentMe fn from(old: DocumentNodePersistentMetadataInputNames) -> Self { DocumentNodePersistentMetadata { input_metadata: Vec::new(), - ..old.into() + reference: old.reference, + display_name: old.display_name, + output_names: old.output_names, + locked: old.locked, + pinned: old.pinned, + node_type_metadata: old.node_type_metadata, + network_metadata: old.network_metadata, } } }