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 95dca57036..912e9b9666 100644 --- a/editor/src/messages/portfolio/document/utility_types/network_interface.rs +++ b/editor/src/messages/portfolio/document/utility_types/network_interface.rs @@ -1607,7 +1607,12 @@ impl NodeNetworkInterface { return; }; - if let Some(selection_state) = network_metadata.persistent_metadata.selection_undo_history.pop_back() { + let mut non_empty_selections:VecDeque = network_metadata.persistent_metadata.selection_redo_history.iter(). + filter(|selected_nodes| selected_nodes.has_selected_nodes()). + cloned(). + collect(); + + if let Some(selection_state) = non_empty_selections.pop_back() { network_metadata.persistent_metadata.selection_redo_history.push_front(selection_state); } } @@ -1618,7 +1623,12 @@ impl NodeNetworkInterface { return; }; - if let Some(selection_state) = network_metadata.persistent_metadata.selection_redo_history.pop_front() { + let mut non_empty_selections:VecDeque = network_metadata.persistent_metadata.selection_redo_history.iter(). + filter(|selected_nodes| selected_nodes.has_selected_nodes()). + cloned(). + collect(); + + if let Some(selection_state) = non_empty_selections.pop_front() { network_metadata.persistent_metadata.selection_undo_history.push_back(selection_state); } }