Skip to content

Commit

Permalink
Merge pull request #15750 from ElectronicBlueberry/workflow-editor-lo…
Browse files Browse the repository at this point in the history
…ading-issue

[23.0] Fix Worflow editor loading issues
  • Loading branch information
mvdbeek committed Mar 9, 2023
2 parents ef2678b + 37e746c commit 8b77750
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions client/src/components/Workflow/Editor/composables/useTerminal.ts
@@ -1,21 +1,29 @@
import type { DatatypesMapperModel } from "@/components/Datatypes/model";
import { terminalFactory } from "@/components/Workflow/Editor/modules/terminals";
import type { Step, TerminalSource } from "@/stores/workflowStepStore";
import { ref, watchEffect, type Ref } from "vue";
import { ref, watch, type Ref, computed } from "vue";
import { useWorkflowStepStore } from "@/stores/workflowStepStore";

export function useTerminal(
stepId: Ref<Step["id"]>,
terminalSource: Ref<TerminalSource>,
datatypesMapper: Ref<DatatypesMapperModel>
) {
const terminal = ref();
const isMappedOver = ref(false);
watchEffect(() => {
// rebuild terminal if any of the tracked dependencies change
const newTerminal = terminalFactory(stepId.value, terminalSource.value, datatypesMapper.value);
newTerminal.getInvalidConnectedTerminals();
terminal.value = newTerminal;
isMappedOver.value = newTerminal.isMappedOver();
});
const terminal: Ref<ReturnType<typeof terminalFactory> | null> = ref(null);
const stepStore = useWorkflowStepStore();
const isMappedOver = computed(() => stepStore.stepMapOver[stepId.value]?.isCollection ?? false);

watch(
[stepId, terminalSource, datatypesMapper],
() => {
// rebuild terminal if any of the tracked dependencies change
const newTerminal = terminalFactory(stepId.value, terminalSource.value, datatypesMapper.value);
newTerminal.getInvalidConnectedTerminals();
terminal.value = newTerminal;
},
{
immediate: true,
}
);
return { terminal: terminal as Ref<ReturnType<typeof terminalFactory>>, isMappedOver };
}

0 comments on commit 8b77750

Please sign in to comment.