Skip to content

Commit

Permalink
Merge pull request #5117 from systeminit/zack/delete-components-not-i…
Browse files Browse the repository at this point in the history
…n-default-view-if-on-head

fix: delete components on head if they are not in default view
  • Loading branch information
zacharyhamm authored Dec 12, 2024
2 parents 5375786 + 50af956 commit 73c568c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/sdf-server/src/service/diagram/delete_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub async fn delete_components(

let mut components = HashMap::new();
let mut socket_map = HashMap::new();
let mut socket_map_head = HashMap::new();
for component_id in request.component_ids {
let component: Component = Component::get_by_id(&ctx, component_id).await?;
let incoming_connections = component.incoming_connections(&ctx).await?.clone();
Expand All @@ -70,7 +71,7 @@ pub async fn delete_components(
// to_delete=True
let component: Component = Component::get_by_id(&ctx, component_id).await?;
let payload = component
.into_frontend_type_for_default_view(&ctx, ChangeStatus::Deleted, &mut socket_map)
.into_frontend_type(&ctx, None, ChangeStatus::Deleted, &mut socket_map)
.await?;
WsEvent::component_updated(&ctx, payload)
.await?
Expand All @@ -80,10 +81,11 @@ pub async fn delete_components(
let component: Component =
Component::get_by_id(&base_change_set_ctx, component_id).await?;
let payload = component
.into_frontend_type_for_default_view(
.into_frontend_type(
&base_change_set_ctx,
None,
ChangeStatus::Deleted,
&mut socket_map,
&mut socket_map_head,
)
.await?;
WsEvent::component_updated(&ctx, payload)
Expand Down

0 comments on commit 73c568c

Please sign in to comment.