diff --git a/js/adapt-contrib-branching.js b/js/adapt-contrib-branching.js index e27eb79..99d18d9 100644 --- a/js/adapt-contrib-branching.js +++ b/js/adapt-contrib-branching.js @@ -74,10 +74,16 @@ class Branching extends Backbone.Controller { } setupEventListeners() { + this.removeEventListeners(); this.listenTo(Adapt, 'view:requestChild', this.onRequestChild); this.listenTo(data, 'change:_isComplete', this.onComplete); } + removeEventListeners() { + this.stopListening(Adapt, 'view:requestChild', this.onRequestChild); + this.stopListening(data, 'change:_isComplete', this.onComplete); + } + onRequestChild(event) { const set = this.getSubsetByModelId(event.target.model.get('_id')); if (!set) return;