From 3d050bdaa31633a954758894629c0eb9fea537d0 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Thu, 14 May 2020 16:41:34 +1000 Subject: [PATCH] DEV: correct test suite We have no choice but to bypass recursive debouncers in test Otherwise we overrun the stack with frames --- .../javascripts/discourse/app/controllers/composer.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/controllers/composer.js b/app/assets/javascripts/discourse/app/controllers/composer.js index e86b14b4553..cd3d3576bbc 100644 --- a/app/assets/javascripts/discourse/app/controllers/composer.js +++ b/app/assets/javascripts/discourse/app/controllers/composer.js @@ -1096,7 +1096,11 @@ export default Controller.extend({ const model = this.model; if (model) { if (model.draftSaving) { - debounce(this, this._saveDraft, 2000); + // in test debounce is Ember.run, this will cause + // an infinite loop + if (ENV.environment !== "test") { + debounce(this, this._saveDraft, 2000); + } } else { model.saveDraft().finally(() => { this._lastDraftSaved = Date.now();