1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-09-21 09:59:34 +03:00

🐛 Fix nodes panel reactivity bug (#1972)

* add keys

* fix nodes panel reactivity bug

* fix lint issues
This commit is contained in:
Mutasem Aldmour 2021-07-08 07:46:20 +02:00 committed by GitHub
parent a74fc78ed3
commit a842e4bc0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -8,7 +8,7 @@
@before-leave="beforeLeave"
@leave="leave"
>
<div v-for="(item, index) in elements" :key="item.key" :class="item.type">
<div v-for="(item, index) in elements" :key="item.key" :class="item.type" :data-key="item.key">
<CreatorItem
:item="item"
:active="activeIndex === index && !disabled"

View File

@ -29,9 +29,17 @@ export default Vue.extend({
props: [
'active',
],
data() {
return {
allNodeTypes: [],
};
},
computed: {
nodeTypes(): INodeTypeDescription[] {
return this.$store.getters.allNodeTypes;
},
visibleNodeTypes(): INodeTypeDescription[] {
return this.$store.getters.allNodeTypes
return this.allNodeTypes
.filter((nodeType: INodeTypeDescription) => {
return !HIDDEN_NODES.includes(nodeType.name);
});
@ -73,6 +81,13 @@ export default Vue.extend({
this.$emit('nodeTypeSelected', nodeTypeName);
},
},
watch: {
nodeTypes(newList, prevList) {
if (prevList.length === 0) {
this.allNodeTypes = newList;
}
},
},
});
</script>