diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 7b307e022a..c71ff756a0 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -3743,6 +3743,8 @@ export default defineComponent({ } }, async initView(): Promise { + await this.loadCredentialsForWorkflow(); + if (this.$route.params.action === 'workflowSave') { // In case the workflow got saved we do not have to run init // as only the route changed but all the needed data is already loaded @@ -3820,7 +3822,7 @@ export default defineComponent({ await this.newWorkflow(); } } - await this.loadCredentials(); + this.historyStore.reset(); this.uiStore.nodeViewInitialized = true; document.addEventListener('keydown', this.keyDown); @@ -4468,12 +4470,13 @@ export default defineComponent({ async loadCredentialTypes(): Promise { await this.credentialsStore.fetchCredentialTypes(true); }, - async loadCredentials(): Promise { + async loadCredentialsForWorkflow(): Promise { const workflow = this.workflowsStore.getWorkflowById(this.currentWorkflow); + const workflowId = workflow?.id ?? this.$route.params.name; let options: { workflowId: string } | { projectId: string }; - if (workflow) { - options = { workflowId: workflow.id }; + if (workflowId) { + options = { workflowId }; } else { const queryParam = typeof this.$route.query?.projectId === 'string' @@ -4801,7 +4804,7 @@ export default defineComponent({ await Promise.all([ this.loadVariables(), this.tagsStore.fetchAll(), - this.loadCredentials(), + this.loadCredentialsForWorkflow(), ]); } catch (error) { console.error(error);