fix: fix slow loading times for nodeTypes, node creator vuex reference, and pushConnection in settings views (#4230)

This commit is contained in:
Alex Grozav 2022-09-29 16:06:40 +03:00 committed by GitHub
parent 3b7de6db72
commit d3c0d99867
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 18 deletions

View file

@ -41,14 +41,9 @@ export default Vue.extend({
props: [
'active',
],
data() {
return {
allLatestNodeTypes: [] as INodeTypeDescription[],
};
},
computed: {
...mapGetters('users', ['personalizedNodeTypes']),
nodeTypes(): INodeTypeDescription[] {
allLatestNodeTypes(): INodeTypeDescription[] {
return this.$store.getters['nodeTypes/allLatestNodeTypes'];
},
visibleNodeTypes(): INodeTypeDescription[] {
@ -107,13 +102,6 @@ export default Vue.extend({
}
},
},
watch: {
nodeTypes(newList) {
if (newList.length !== this.allLatestNodeTypes.length) {
this.allLatestNodeTypes = newList;
}
},
},
});
</script>

View file

@ -56,11 +56,13 @@ import mixins from 'vue-typed-mixins';
import { mapGetters } from 'vuex';
import { ABOUT_MODAL_KEY, VERSIONS_MODAL_KEY, VIEWS } from '@/constants';
import { userHelpers } from './mixins/userHelpers';
import { pushConnection } from "@/components/mixins/pushConnection";
import { IFakeDoor } from '@/Interface';
import GiftNotificationIcon from './GiftNotificationIcon.vue';
export default mixins(
userHelpers,
pushConnection,
).extend({
name: 'SettingsSidebar',
components: {
@ -95,6 +97,9 @@ export default mixins(
this.$store.dispatch('ui/openModal', VERSIONS_MODAL_KEY);
},
},
mounted() {
this.pushConnect();
},
});
</script>

View file

@ -362,6 +362,7 @@ export const pushConnection = mixins(
this.processWaitingPushMessages();
} else if (receivedData.type === 'reloadNodeType') {
this.$store.dispatch('nodeTypes/getNodeTypes');
this.$store.dispatch('nodeTypes/getFullNodesProperties', [receivedData.data]);
} else if (receivedData.type === 'removeNodeType') {
const pushData = receivedData.data;

View file

@ -57,7 +57,7 @@ const module: Module<INodeTypesState, IRootState> = {
},
},
mutations: {
setNodeTypes(state, newNodeTypes: INodeTypeDescription[]) {
setNodeTypes(state, newNodeTypes: INodeTypeDescription[] = []) {
const nodeTypes = newNodeTypes.reduce<Record<string, Record<string, INodeTypeDescription>>>((acc, newNodeType) => {
const newNodeVersions = getNodeVersions(newNodeType);

View file

@ -393,11 +393,16 @@ export default mixins(
});
},
async initialize() {
await Promise.all([
const loadPromises = [
this.$store.dispatch('credentials/fetchAllCredentials'),
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.$nextTick(this.focusSearchInput);

View file

@ -3044,9 +3044,12 @@ export default mixins(
this.loadActiveWorkflows(),
this.loadCredentials(),
this.loadCredentialTypes(),
this.loadNodeTypes(),
];
if (this.$store.getters['nodeTypes/allNodeTypes'].length === 0) {
loadPromises.push(this.loadNodeTypes());
}
try {
await Promise.all(loadPromises);
} catch (error) {