Wrap recompile response handlers in $applyAsync (#4253)

GitOrigin-RevId: 80e5652b88ba70b3ea1aef2cf24430597574353e
This commit is contained in:
Alf Eaton 2021-06-23 14:16:38 +01:00 committed by Copybot
parent be73463e35
commit 9b9d6f679e

View file

@ -832,27 +832,33 @@ App.controller(
.then(function (response) { .then(function (response) {
const { data } = response const { data } = response
const compileTimeClientE2E = performance.now() - t0 const compileTimeClientE2E = performance.now() - t0
$scope.pdf.view = 'pdf' $scope.$applyAsync(() => {
$scope.pdf.compiling = false $scope.pdf.view = 'pdf'
parseCompileResponse(data, compileTimeClientE2E) $scope.pdf.compiling = false
parseCompileResponse(data, compileTimeClientE2E)
})
}) })
.catch(function (response) { .catch(function (response) {
const { status } = response const { status } = response
if (status === 429) { $scope.$applyAsync(() => {
$scope.pdf.rateLimited = true if (status === 429) {
} $scope.pdf.rateLimited = true
$scope.pdf.compiling = false }
$scope.pdf.renderingError = false $scope.pdf.compiling = false
$scope.pdf.error = true $scope.pdf.renderingError = false
$scope.pdf.view = 'errors' $scope.pdf.error = true
if (window.showNewLogsUI) { $scope.pdf.view = 'errors'
$scope.clsiErrors = { error: true } if (window.showNewLogsUI) {
$scope.shouldShowLogs = true $scope.clsiErrors = { error: true }
$scope.pdf.compileFailed = true $scope.shouldShowLogs = true
} $scope.pdf.compileFailed = true
}
})
}) })
.finally(() => { .finally(() => {
$scope.lastFinishedCompileAt = Date.now() $scope.$applyAsync(() => {
$scope.lastFinishedCompileAt = Date.now()
})
}) })
} }