fix: rever await nextTick changes

This commit is contained in:
Alex Grozav 2023-07-27 12:25:08 +03:00
parent ceb6f8bdae
commit 67b5c161de

View file

@ -781,9 +781,12 @@ export default defineComponent({
deepCopy(data.workflowData.nodes), deepCopy(data.workflowData.nodes),
deepCopy(data.workflowData.connections), deepCopy(data.workflowData.connections),
); );
await this.$nextTick();
this.canvasStore.zoomToFit(); void this.$nextTick(() => {
this.uiStore.stateIsDirty = false; this.canvasStore.zoomToFit();
this.uiStore.stateIsDirty = false;
});
void this.$externalHooks().run('execution.open', { void this.$externalHooks().run('execution.open', {
workflowId: data.workflowData.id, workflowId: data.workflowData.id,
workflowName: data.workflowData.name, workflowName: data.workflowData.name,
@ -851,8 +854,9 @@ export default defineComponent({
this.workflowsStore.setWorkflowPinData(data.workflow.pinData); this.workflowsStore.setWorkflowPinData(data.workflow.pinData);
} }
await this.$nextTick(); void this.$nextTick(() => {
this.canvasStore.zoomToFit(); this.canvasStore.zoomToFit();
});
}, },
async openWorkflowTemplate(templateId: string) { async openWorkflowTemplate(templateId: string) {
this.startLoading(); this.startLoading();
@ -893,9 +897,10 @@ export default defineComponent({
await this.addNodes(data.workflow.nodes, data.workflow.connections); await this.addNodes(data.workflow.nodes, data.workflow.connections);
this.workflowData = (await this.workflowsStore.getNewWorkflowData(data.name)) || {}; this.workflowData = (await this.workflowsStore.getNewWorkflowData(data.name)) || {};
await this.$nextTick(); void this.$nextTick(() => {
this.canvasStore.zoomToFit(); this.canvasStore.zoomToFit();
this.uiStore.stateIsDirty = true; this.uiStore.stateIsDirty = true;
});
void this.$externalHooks().run('template.open', { void this.$externalHooks().run('template.open', {
templateId, templateId,
@ -3761,12 +3766,13 @@ export default defineComponent({
// exist // exist
const actionWatcher = this.workflowsStore.$onAction(({ name, after, args }) => { const actionWatcher = this.workflowsStore.$onAction(({ name, after, args }) => {
if (name === 'addNode' && args[0].type === nodeTypeName) { if (name === 'addNode' && args[0].type === nodeTypeName) {
after(async () => { after(() => {
const lastAddedNode = this.nodes[this.nodes.length - 1]; const lastAddedNode = this.nodes[this.nodes.length - 1];
const previouslyAddedNode = this.nodes[this.nodes.length - 2]; const previouslyAddedNode = this.nodes[this.nodes.length - 2];
await this.$nextTick(); void this.$nextTick(() =>
this.connectTwoNodes(previouslyAddedNode.name, 0, lastAddedNode.name, 0); this.connectTwoNodes(previouslyAddedNode.name, 0, lastAddedNode.name, 0),
);
// Position the added node to the right side of the previously added one // Position the added node to the right side of the previously added one
lastAddedNode.position = [ lastAddedNode.position = [