Fix 'Grid' node migrations breaking up-to-date documents
Some checks are pending
Editor: Dev & CI / cargo-deny (push) Waiting to run
Editor: Dev & CI / build (push) Waiting to run

This commit is contained in:
Keavon Chambers 2025-07-07 18:39:04 -07:00
parent 69ed80b79b
commit a1d93da532

View file

@ -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