Fix infinite recursion introduced in #2795 that occurs in old document migrations

This commit is contained in:
Keavon Chambers 2025-09-05 14:04:10 -07:00
parent ad99c14b29
commit 89c9cf1352
2 changed files with 8 additions and 17 deletions

View File

@ -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<NodeNetworkMetadata>,
}
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(_))

View File

@ -23,7 +23,13 @@ impl From<DocumentNodePersistentMetadataInputNames> 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,
}
}
}