From a1d93da532d0ffa88a2235ab6faecbdee32d6d2d Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Mon, 7 Jul 2025 18:39:04 -0700 Subject: [PATCH] Fix 'Grid' node migrations breaking up-to-date documents --- editor/src/messages/portfolio/document_migration.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/editor/src/messages/portfolio/document_migration.rs b/editor/src/messages/portfolio/document_migration.rs index 7567883c..f3b018a6 100644 --- a/editor/src/messages/portfolio/document_migration.rs +++ b/editor/src/messages/portfolio/document_migration.rs @@ -639,6 +639,8 @@ pub fn document_migration_upgrades(document: &mut DocumentMessageHandler, reset_ let old_inputs = document.network_interface.replace_inputs(node_id, network_path, &mut new_node_template).unwrap(); let index_3_value = old_inputs.get(3).cloned(); + let mut upgraded = false; + if let Some(NodeInput::Value { tagged_value, exposed: _ }) = index_3_value { if matches!(*tagged_value, TaggedValue::DVec2(_)) { // Move index 3 to the end @@ -648,11 +650,14 @@ pub fn document_migration_upgrades(document: &mut DocumentMessageHandler, reset_ document.network_interface.set_input(&InputConnector::node(*node_id, 3), old_inputs[4].clone(), network_path); document.network_interface.set_input(&InputConnector::node(*node_id, 4), old_inputs[5].clone(), network_path); document.network_interface.set_input(&InputConnector::node(*node_id, 5), old_inputs[3].clone(), network_path); - } else { - // Swap it back if we're not changing anything - let _ = document.network_interface.replace_inputs(node_id, network_path, &mut current_node_template); + + upgraded = true; } } + + if !upgraded { + let _ = document.network_interface.replace_inputs(node_id, network_path, &mut current_node_template); + } } // Ensure layers are positioned as stacks if they are upstream siblings of another layer