fix: Allow pasting a big workflow (#6760)

* fix: pasting a big workflow

* chore: update comment

* refactor: move try/catch to function

* refactor: move try/catch to function
This commit is contained in:
Mutasem Aldmour 2023-07-27 13:00:22 +02:00 committed by GitHub
parent 6a6fbb6e6c
commit a81fdca7bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -502,7 +502,9 @@ export default defineComponent({
}
},
mounted() {
this.setSubtitle();
setTimeout(() => {
this.setSubtitle();
}, 0);
if (this.nodeRunData) {
setTimeout(() => {
this.$emit('run', {
@ -539,10 +541,18 @@ export default defineComponent({
this.unwatchWorkflowDataItems();
},
setSubtitle() {
const nodeSubtitle =
this.getNodeSubtitle(this.data, this.nodeType, this.getCurrentWorkflow()) || '';
// why is this not a computed property? because it's a very expensive operation
// it requires expressions to resolve each subtitle...
// and ends up bogging down the UI with big workflows, for example when pasting a workflow or even opening a node...
// so we only update it when necessary (when node is mounted and when it's opened and closed (isActive))
try {
const nodeSubtitle =
this.getNodeSubtitle(this.data, this.nodeType, this.getCurrentWorkflow()) || '';
this.nodeSubtitle = nodeSubtitle.includes(CUSTOM_API_CALL_KEY) ? '' : nodeSubtitle;
this.nodeSubtitle = nodeSubtitle.includes(CUSTOM_API_CALL_KEY) ? '' : nodeSubtitle;
} catch (e) {
// avoid breaking UI if expression error occurs
}
},
disableNode() {
if (this.data !== null) {