Skip to content

Commit 89c9cf1

Browse files
committed
Fix infinite recursion introduced in #2795 that occurs in old document migrations
1 parent ad99c14 commit 89c9cf1

2 files changed

Lines changed: 8 additions & 17 deletions

File tree

editor/src/messages/portfolio/document/utility_types/network_interface.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6649,7 +6649,7 @@ struct InputTransientMetadata {
66496649
}
66506650

66516651
/// Persistent metadata for each node in the network, which must be included when creating, serializing, and deserializing saving a node.
6652-
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
6652+
#[derive(Default, Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
66536653
pub struct DocumentNodePersistentMetadata {
66546654
/// 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.
66556655
// 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 {
66766676
pub network_metadata: Option<NodeNetworkMetadata>,
66776677
}
66786678

6679-
impl Default for DocumentNodePersistentMetadata {
6680-
fn default() -> Self {
6681-
DocumentNodePersistentMetadata {
6682-
reference: None,
6683-
display_name: String::new(),
6684-
input_metadata: Vec::new(),
6685-
output_names: Vec::new(),
6686-
pinned: false,
6687-
locked: false,
6688-
node_type_metadata: NodeTypePersistentMetadata::default(),
6689-
network_metadata: None,
6690-
}
6691-
}
6692-
}
6693-
66946679
impl DocumentNodePersistentMetadata {
66956680
pub fn is_layer(&self) -> bool {
66966681
matches!(self.node_type_metadata, NodeTypePersistentMetadata::Layer(_))

editor/src/messages/portfolio/document/utility_types/network_interface/deserialization.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ impl From<DocumentNodePersistentMetadataInputNames> for DocumentNodePersistentMe
2323
fn from(old: DocumentNodePersistentMetadataInputNames) -> Self {
2424
DocumentNodePersistentMetadata {
2525
input_metadata: Vec::new(),
26-
..old.into()
26+
reference: old.reference,
27+
display_name: old.display_name,
28+
output_names: old.output_names,
29+
locked: old.locked,
30+
pinned: old.pinned,
31+
node_type_metadata: old.node_type_metadata,
32+
network_metadata: old.network_metadata,
2733
}
2834
}
2935
}

0 commit comments

Comments
 (0)