Skip to content

Commit

Permalink
Merge pull request #2915 from botpress/ya-fix-flow
Browse files Browse the repository at this point in the history
fix(flow): lag issue with a lot of content
  • Loading branch information
allardy committed Jan 30, 2020
2 parents 38460b3 + 381967e commit e372d5b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Expand Up @@ -37,7 +37,7 @@ class ActionItem extends Component<Props> {
}

if (prevState.itemId !== this.state.itemId && this.state.itemId) {
this.props.fetchContentItem(this.state.itemId, { force: true, batched: true }).then(this.props.refreshFlowsLinks)
this.props.fetchContentItem(this.state.itemId, { force: true, batched: true })
}
}

Expand Down
22 changes: 13 additions & 9 deletions src/bp/ui-studio/src/web/views/FlowBuilder/diagram/index.tsx
Expand Up @@ -326,9 +326,9 @@ class Diagram extends Component<Props> {
)
}

checkForProblems() {
checkForProblems = _.debounce(() => {
this.props.updateFlowProblems(this.manager.getNodeProblems())
}
}, 500)

createFlow(name: string) {
this.props.createFlow(name + '.flow.json')
Expand Down Expand Up @@ -378,14 +378,18 @@ class Diagram extends Component<Props> {
this.checkForLinksUpdate()
}

checkForLinksUpdate() {
const links = this.manager.getLinksRequiringUpdate()
if (links) {
this.props.updateFlow({ links })
}
checkForLinksUpdate = _.debounce(
() => {
const links = this.manager.getLinksRequiringUpdate()
if (links) {
this.props.updateFlow({ links })
}

this.checkForProblems()
}
this.checkForProblems()
},
500,
{ leading: true }
)

deleteSelectedElements() {
const elements = _.sortBy(this.diagramEngine.getDiagramModel().getSelectedItems(), 'nodeType')
Expand Down

0 comments on commit e372d5b

Please sign in to comment.