Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions packages/editor-ui/src/components/NodeCreator/NodeCreator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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[] {
Expand Down Expand Up @@ -107,13 +102,6 @@ export default Vue.extend({
}
},
},
watch: {
nodeTypes(newList) {
if (newList.length !== this.allLatestNodeTypes.length) {
this.allLatestNodeTypes = newList;
}
},
},
});
</script>

Expand Down
5 changes: 5 additions & 0 deletions packages/editor-ui/src/components/SettingsSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -95,6 +97,9 @@ export default mixins(
this.$store.dispatch('ui/openModal', VERSIONS_MODAL_KEY);
},
},
mounted() {
this.pushConnect();
},
});
</script>

Expand Down
1 change: 1 addition & 0 deletions packages/editor-ui/src/components/mixins/pushConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,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;
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/modules/nodeTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
11 changes: 8 additions & 3 deletions packages/editor-ui/src/views/CredentialsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion packages/editor-ui/src/views/NodeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3125,9 +3125,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) {
Expand Down