mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
fix(editor): Load credentials for workflow before determining credentials errors (#9876)
Co-authored-by: Csaba Tuncsik <csaba.tuncsik@gmail.com>
This commit is contained in:
parent
9454a851bb
commit
4008c147d7
|
@ -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
|
||||
|
@ -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<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'
|
||||
|
@ -4801,7 +4804,7 @@ export default defineComponent({
|
|||
await Promise.all([
|
||||
this.loadVariables(),
|
||||
this.tagsStore.fetchAll(),
|
||||
this.loadCredentials(),
|
||||
this.loadCredentialsForWorkflow(),
|
||||
]);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
|
Loading…
Reference in a new issue