Skip to content

Commit

Permalink
fix(editor): Load credentials for workflow before determining credent…
Browse files Browse the repository at this point in the history
…ials errors (#9876)

Co-authored-by: Csaba Tuncsik <csaba.tuncsik@gmail.com>
  • Loading branch information
RicardoE105 and cstuncsik authored Jun 27, 2024
1 parent 9454a85 commit 4008c14
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/editor-ui/src/views/NodeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3743,6 +3743,8 @@ export default defineComponent({
}
},
async initView(): Promise<void> {
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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -4468,12 +4470,13 @@ export default defineComponent({
async loadCredentialTypes(): Promise<void> {
await this.credentialsStore.fetchCredentialTypes(true);
},
async loadCredentials(): Promise<void> {
async loadCredentialsForWorkflow(): Promise<void> {
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'
Expand Down Expand Up @@ -4801,7 +4804,7 @@ export default defineComponent({
await Promise.all([
this.loadVariables(),
this.tagsStore.fetchAll(),
this.loadCredentials(),
this.loadCredentialsForWorkflow(),
]);
} catch (error) {
console.error(error);
Expand Down

0 comments on commit 4008c14

Please sign in to comment.