mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-27 10:03:13 +00:00
Handle undefined $scope.connection (#7899)
GitOrigin-RevId: d54fbd9da2bfe694cca91a81ccff3ec669b181e3
This commit is contained in:
parent
cd09e2c029
commit
54d66a8e09
1 changed files with 9 additions and 5 deletions
|
@ -36,11 +36,15 @@ App.controller(
|
|||
// connection state goes into 'waitingCountdown' before being hidden and we
|
||||
// don't want to show a disconnect UI.
|
||||
function updateIsConnected() {
|
||||
const isReady = $scope.connection.state === 'ready'
|
||||
const willStartCountdown =
|
||||
$scope.connection.state === 'waitingCountdown' &&
|
||||
$scope.connection.reconnection_countdown === null
|
||||
$scope.isConnected = isReady || willStartCountdown
|
||||
if ($scope.connection) {
|
||||
const isReady = $scope.connection.state === 'ready'
|
||||
const willStartCountdown =
|
||||
$scope.connection.state === 'waitingCountdown' &&
|
||||
$scope.connection.reconnection_countdown === null
|
||||
$scope.isConnected = isReady || willStartCountdown
|
||||
} else {
|
||||
$scope.isConnected = false
|
||||
}
|
||||
}
|
||||
|
||||
$scope.$watch('connection.state', updateIsConnected)
|
||||
|
|
Loading…
Reference in a new issue