Skip to content

Commit

Permalink
✨ Adding force flag to credentials fetching (#3527)
Browse files Browse the repository at this point in the history
* ✨ Adding `force` flag to credentials fetching which can be used to skip check when loading credentials

* ✨ Forcing credentials loading when opening nodeView
  • Loading branch information
MiloradFilipovic committed Jun 16, 2022
1 parent cb5a67d commit 2aa6b8f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/editor-ui/src/components/mixins/pushConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ export const pushConnection = mixins(
const nodesToBeFetched: INodeTypeNameVersion[] = [pushData];

// Force reload of all credential types
this.$store.dispatch('credentials/fetchCredentialTypes')
this.$store.dispatch('credentials/fetchCredentialTypes', true)
.then(() => {
// Get the data of the node and update in internal storage
return this.restApi().getNodesInformation(nodesToBeFetched);
Expand Down
4 changes: 2 additions & 2 deletions packages/editor-ui/src/modules/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ const module: Module<ICredentialsState, IRootState> = {
},
},
actions: {
fetchCredentialTypes: async (context: ActionContext<ICredentialsState, IRootState>) => {
if (context.getters.allCredentialTypes.length > 0) {
fetchCredentialTypes: async (context: ActionContext<ICredentialsState, IRootState>, forceFetch: boolean) => {
if (context.getters.allCredentialTypes.length > 0 && forceFetch !== true) {
return;
}
const credentialTypes = await getCredentialTypes(context.rootGetters.getRestApiContext);
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/views/NodeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2834,7 +2834,7 @@ export default mixins(
this.$store.commit('setNodeTypes', nodeTypes);
},
async loadCredentialTypes (): Promise<void> {
await this.$store.dispatch('credentials/fetchCredentialTypes');
await this.$store.dispatch('credentials/fetchCredentialTypes', true);
},
async loadCredentials (): Promise<void> {
await this.$store.dispatch('credentials/fetchAllCredentials');
Expand Down

0 comments on commit 2aa6b8f

Please sign in to comment.