diff --git a/services/web/app/src/Features/Project/ProjectRootDocManager.js b/services/web/app/src/Features/Project/ProjectRootDocManager.js index 89f79f2e5a..43459b0489 100644 --- a/services/web/app/src/Features/Project/ProjectRootDocManager.js +++ b/services/web/app/src/Features/Project/ProjectRootDocManager.js @@ -43,9 +43,13 @@ module.exports = ProjectRootDocManager = { ProjectEntityUpdateHandler.isPathValidForRootDoc(path) && DocumentHelper.contentHasDocumentclass(doc.lines) ) { - return cb(doc._id) + async.setImmediate(function() { + cb(doc._id) + }) } else { - return cb(null) + async.setImmediate(function() { + cb(null) + }) } } ) diff --git a/services/web/test/unit/src/Project/ProjectRootDocManagerTests.js b/services/web/test/unit/src/Project/ProjectRootDocManagerTests.js index 9f6f28b310..84c1290226 100644 --- a/services/web/test/unit/src/Project/ProjectRootDocManagerTests.js +++ b/services/web/test/unit/src/Project/ProjectRootDocManagerTests.js @@ -113,7 +113,7 @@ describe('ProjectRootDocManager', function() { }) describe('when the root doc is an Rtex file', function() { - beforeEach(function() { + beforeEach(function(done) { this.docs = { '/chapter1.tex': { _id: 'doc-id-1', @@ -129,7 +129,7 @@ describe('ProjectRootDocManager', function() { .callsArgWith(1, null, this.docs) return this.ProjectRootDocManager.setRootDocAutomatically( this.project_id, - this.callback + done ) })