fix(frontend): Remove output when deleting a component (#1397)

This commit is contained in:
Faton Ramadani
2023-04-12 10:28:54 +02:00
committed by GitHub
parent 3c9cd9218d
commit fac95318cd
3 changed files with 1 additions and 37 deletions
@@ -22,7 +22,6 @@
app,
mode,
connectingInput,
runnableComponents,
summary,
focusedGrid,
parentWidth,
@@ -39,40 +38,6 @@
.flatMap((id) => dfs($app.grid, id, $app.subgrids ?? {}))
.filter((x) => x != undefined) as string[]
}
function removeGridElement(component) {
if (component) {
$app.grid = $app.grid.filter((gridComponent) => {
if (gridComponent.data.id === component.id) {
if (
gridComponent.data.componentInput?.type === 'runnable' &&
gridComponent.data.componentInput?.runnable?.type === 'runnableByName' &&
gridComponent.data.componentInput?.runnable.inlineScript
) {
const { name, inlineScript } = gridComponent.data.componentInput?.runnable
if (!$app.unusedInlineScripts) {
$app.unusedInlineScripts = []
}
$app.unusedInlineScripts.push({
name,
inlineScript
})
$app = $app
}
}
return gridComponent.data.id !== component?.id
})
delete $runnableComponents[component.id]
$runnableComponents = $runnableComponents
$selectedComponent = undefined
}
}
</script>
<div class="relative w-full z-20 overflow-visible">
@@ -135,7 +100,6 @@
component={dataItem.data}
selected={Boolean($selectedComponent?.includes(dataItem.id))}
locked={isFixed(dataItem)}
on:delete={() => removeGridElement(dataItem.data)}
on:lock={() => {
const gridItem = findGridItem($app, dataItem.id)
if (gridItem) {
@@ -79,7 +79,6 @@
{component}
{selected}
shouldHideActions={$connectingInput.opened}
on:delete
on:lock
on:expand
{locked}
@@ -59,6 +59,7 @@
push(history, $app)
if (componentSettings?.item.id) {
delete $worldStore.outputsById[componentSettings?.item.id]
$errorByComponent = clearErrorByComponentId(componentSettings?.item.id, $errorByComponent)
$jobs = clearJobsByComponentId(componentSettings?.item.id, $jobs)