mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix: fix slow loading times for nodeTypes, node creator vuex reference, and pushConnection in settings views (#4230)
This commit is contained in:
parent
3b7de6db72
commit
d3c0d99867
|
@ -41,14 +41,9 @@ export default Vue.extend({
|
||||||
props: [
|
props: [
|
||||||
'active',
|
'active',
|
||||||
],
|
],
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
allLatestNodeTypes: [] as INodeTypeDescription[],
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters('users', ['personalizedNodeTypes']),
|
...mapGetters('users', ['personalizedNodeTypes']),
|
||||||
nodeTypes(): INodeTypeDescription[] {
|
allLatestNodeTypes(): INodeTypeDescription[] {
|
||||||
return this.$store.getters['nodeTypes/allLatestNodeTypes'];
|
return this.$store.getters['nodeTypes/allLatestNodeTypes'];
|
||||||
},
|
},
|
||||||
visibleNodeTypes(): INodeTypeDescription[] {
|
visibleNodeTypes(): INodeTypeDescription[] {
|
||||||
|
@ -107,13 +102,6 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
nodeTypes(newList) {
|
|
||||||
if (newList.length !== this.allLatestNodeTypes.length) {
|
|
||||||
this.allLatestNodeTypes = newList;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -56,11 +56,13 @@ import mixins from 'vue-typed-mixins';
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import { ABOUT_MODAL_KEY, VERSIONS_MODAL_KEY, VIEWS } from '@/constants';
|
import { ABOUT_MODAL_KEY, VERSIONS_MODAL_KEY, VIEWS } from '@/constants';
|
||||||
import { userHelpers } from './mixins/userHelpers';
|
import { userHelpers } from './mixins/userHelpers';
|
||||||
|
import { pushConnection } from "@/components/mixins/pushConnection";
|
||||||
import { IFakeDoor } from '@/Interface';
|
import { IFakeDoor } from '@/Interface';
|
||||||
import GiftNotificationIcon from './GiftNotificationIcon.vue';
|
import GiftNotificationIcon from './GiftNotificationIcon.vue';
|
||||||
|
|
||||||
export default mixins(
|
export default mixins(
|
||||||
userHelpers,
|
userHelpers,
|
||||||
|
pushConnection,
|
||||||
).extend({
|
).extend({
|
||||||
name: 'SettingsSidebar',
|
name: 'SettingsSidebar',
|
||||||
components: {
|
components: {
|
||||||
|
@ -95,6 +97,9 @@ export default mixins(
|
||||||
this.$store.dispatch('ui/openModal', VERSIONS_MODAL_KEY);
|
this.$store.dispatch('ui/openModal', VERSIONS_MODAL_KEY);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.pushConnect();
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -362,6 +362,7 @@ export const pushConnection = mixins(
|
||||||
|
|
||||||
this.processWaitingPushMessages();
|
this.processWaitingPushMessages();
|
||||||
} else if (receivedData.type === 'reloadNodeType') {
|
} else if (receivedData.type === 'reloadNodeType') {
|
||||||
|
this.$store.dispatch('nodeTypes/getNodeTypes');
|
||||||
this.$store.dispatch('nodeTypes/getFullNodesProperties', [receivedData.data]);
|
this.$store.dispatch('nodeTypes/getFullNodesProperties', [receivedData.data]);
|
||||||
} else if (receivedData.type === 'removeNodeType') {
|
} else if (receivedData.type === 'removeNodeType') {
|
||||||
const pushData = receivedData.data;
|
const pushData = receivedData.data;
|
||||||
|
|
|
@ -57,7 +57,7 @@ const module: Module<INodeTypesState, IRootState> = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
setNodeTypes(state, newNodeTypes: INodeTypeDescription[]) {
|
setNodeTypes(state, newNodeTypes: INodeTypeDescription[] = []) {
|
||||||
const nodeTypes = newNodeTypes.reduce<Record<string, Record<string, INodeTypeDescription>>>((acc, newNodeType) => {
|
const nodeTypes = newNodeTypes.reduce<Record<string, Record<string, INodeTypeDescription>>>((acc, newNodeType) => {
|
||||||
const newNodeVersions = getNodeVersions(newNodeType);
|
const newNodeVersions = getNodeVersions(newNodeType);
|
||||||
|
|
||||||
|
|
|
@ -393,11 +393,16 @@ export default mixins(
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async initialize() {
|
async initialize() {
|
||||||
await Promise.all([
|
const loadPromises = [
|
||||||
this.$store.dispatch('credentials/fetchAllCredentials'),
|
this.$store.dispatch('credentials/fetchAllCredentials'),
|
||||||
this.$store.dispatch('credentials/fetchCredentialTypes'),
|
this.$store.dispatch('credentials/fetchCredentialTypes'),
|
||||||
this.$store.dispatch('nodeTypes/getNodeTypes'),
|
];
|
||||||
]);
|
|
||||||
|
if (this.$store.getters['nodeTypes/allNodeTypes'].length === 0) {
|
||||||
|
loadPromises.push(this.$store.dispatch('nodeTypes/getNodeTypes'));
|
||||||
|
}
|
||||||
|
|
||||||
|
await Promise.all(loadPromises);
|
||||||
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.$nextTick(this.focusSearchInput);
|
this.$nextTick(this.focusSearchInput);
|
||||||
|
|
|
@ -3044,9 +3044,12 @@ export default mixins(
|
||||||
this.loadActiveWorkflows(),
|
this.loadActiveWorkflows(),
|
||||||
this.loadCredentials(),
|
this.loadCredentials(),
|
||||||
this.loadCredentialTypes(),
|
this.loadCredentialTypes(),
|
||||||
this.loadNodeTypes(),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (this.$store.getters['nodeTypes/allNodeTypes'].length === 0) {
|
||||||
|
loadPromises.push(this.loadNodeTypes());
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await Promise.all(loadPromises);
|
await Promise.all(loadPromises);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in a new issue