Skip to content

Commit

Permalink
merge: #3776
Browse files Browse the repository at this point in the history
3776: Component updated called when to_delete=True. Component deleted already called r=jobelenus a=jobelenus

Undoing a boo-boo
<img src="https://media1.giphy.com/media/4Kj5bMvEypv9ja9LMr/giphy-downsized-medium.gif"/>

Co-authored-by: John Obelenus <jobelenus@systeminit.com>
  • Loading branch information
si-bors-ng[bot] and jobelenus committed May 14, 2024
2 parents ab16e0c + ae2129a commit db2a674
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/sdf-server/src/server/service/diagram/delete_component.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use axum::{extract::OriginalUri, http::uri::Uri};
use axum::{response::IntoResponse, Json};
use dal::diagram::SummaryDiagramComponent;
use dal::{ChangeSet, Component, ComponentId, DalContext, Visibility, WsEvent};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
Expand Down Expand Up @@ -65,10 +66,16 @@ pub async fn delete_components(
delete_single_component(&ctx, component_id, &original_uri, &posthog_client).await?;
components.insert(component_id, maybe.is_some());

WsEvent::component_deleted(&ctx, component_id)
.await?
.publish_on_commit(&ctx)
.await?;
if let Some(maybe) = maybe {
// to_delete=True
let component: Component = Component::get_by_id(&ctx, maybe.id()).await?;
let payload: SummaryDiagramComponent =
SummaryDiagramComponent::assemble(&ctx, &component).await?;
WsEvent::component_updated(&ctx, payload)
.await?
.publish_on_commit(&ctx)
.await?;
} // component_deleted called further down the stack
}

ctx.commit().await?;
Expand Down

0 comments on commit db2a674

Please sign in to comment.