diff --git a/src/app/production/[id]/page.tsx b/src/app/production/[id]/page.tsx index abda8957..9072e9d3 100644 --- a/src/app/production/[id]/page.tsx +++ b/src/app/production/[id]/page.tsx @@ -1014,7 +1014,8 @@ export default function ProductionConfiguration({ params }: PageProps) { const updatedSetup = removeSetupItem( selectedSourceRef, productionSetup, - ingestSourceId + ingestSourceId, + ingestSource?.ingest_name ); if (!updatedSetup) return; @@ -1193,7 +1194,8 @@ export default function ProductionConfiguration({ params }: PageProps) { input_slot: source.input_slot }, productionSetup, - ingestSourceId + ingestSourceId, + ingestSource?.ingest_name ); if (!updatedSetup) return; setProductionSetup(updatedSetup); diff --git a/src/hooks/items/removeSetupItem.ts b/src/hooks/items/removeSetupItem.ts index 12aa0928..9e15006f 100644 --- a/src/hooks/items/removeSetupItem.ts +++ b/src/hooks/items/removeSetupItem.ts @@ -4,7 +4,8 @@ import { Production } from '../../interfaces/production'; export function removeSetupItem( source: SourceReference, productionSetup: Production, - ingestSourceId?: number + ingestSourceId?: number, + ingestName?: string ): Production | null { const tempItems = productionSetup.sources.filter( (tempItem) => tempItem._id !== source._id @@ -12,13 +13,15 @@ export function removeSetupItem( let updatedPipelines = productionSetup.production_settings.pipelines; - if (ingestSourceId !== undefined) { + if (ingestSourceId !== undefined && ingestName !== undefined) { updatedPipelines = productionSetup.production_settings.pipelines.map( (pipeline) => ({ ...pipeline, sources: pipeline.sources ? pipeline.sources.filter( - (pipelineSource) => pipelineSource.source_id !== ingestSourceId + (pipelineSource) => + pipelineSource.source_id !== ingestSourceId || + pipelineSource.settings.ingest_name !== ingestName ) : [] })