Skip to content

Commit 503291e

Browse files
committed
Merge pull request #381 from CodeNow/remove-safeapply
remove safeApply
2 parents e838eec + e3bb36f commit 503291e

File tree

61 files changed

+31
-307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+31
-307
lines changed

client/controllers/abstractLayouts/controllerInstanceLayout.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ function ControllerInstanceLayout(
1010
$stateParams,
1111
errs,
1212
$rootScope,
13+
$timeout,
1314
keypather,
1415
async,
1516
$scope
@@ -36,7 +37,8 @@ function ControllerInstanceLayout(
3637
function (cb) {
3738
$rootScope.dataApp.state.loadingInstances = true;
3839
$rootScope.dataApp.data.instances = null;
39-
$rootScope.safeApply(cb);
40+
// Using $timeout to trigger digest
41+
$timeout(cb);
4042
},
4143
function (cb) {
4244
fetchInstances(username, true, cb);
@@ -45,7 +47,7 @@ function ControllerInstanceLayout(
4547
if (username === keypather.get($rootScope, 'dataApp.data.activeAccount.oauthName()')) {
4648
$rootScope.dataApp.data.instances = instances;
4749
$rootScope.dataApp.state.loadingInstances = false;
48-
$rootScope.safeApply(cb);
50+
$timeout(cb);
4951
} else {
5052
cb();
5153
}

client/controllers/controllerApp.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ function ControllerApp(
5050
dataApp.data.activeAccount = thisUser;
5151
}
5252
$rootScope.$broadcast('INSTANCE_LIST_FETCH', dataApp.data.activeAccount.oauthName());
53-
$rootScope.safeApply();
5453
}
5554
});
5655
}
@@ -115,7 +114,6 @@ function ControllerApp(
115114
$window.olark('api.visitor.updateFullName', { fullName: thisUser.oauthName() });
116115
$window.olark('api.box.show');
117116
}
118-
$rootScope.safeApply();
119117
});
120118
} else {
121119
return errs.handler(err);

client/controllers/home/controllerHome.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ function ControllerHome(
4949
fetchUser(function (err, user) {
5050
if (err) { return cb(err); }
5151
$scope.user = user;
52-
$scope.safeApply();
5352
cb();
5453
});
5554
},

client/controllers/instance/controllerInstance.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ function ControllerInstance(
119119
$stateParams.instanceName
120120
);
121121
data.instance.state = {};
122-
$scope.safeApply();
123122
cb();
124123
}
125124
})

client/controllers/instanceEdit/controllerInstanceEdit.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ function ControllerInstanceEdit(
4343
var instance = instances.models[0];
4444
data.instance = instance;
4545
data.instance.state = {};
46-
$scope.safeApply();
4746
cb();
4847
})
4948
.resolve(function (err, instances, cb) {
@@ -54,7 +53,6 @@ function ControllerInstanceEdit(
5453
var instance = instances.models[0];
5554
data.instance = instance;
5655
data.instance.state = {};
57-
$scope.safeApply();
5856
cb();
5957
})
6058
.go();
@@ -70,12 +68,10 @@ function ControllerInstanceEdit(
7068
return cb(null, true);
7169
}
7270
$scope.build = build;
73-
$scope.safeApply();
7471
cb();
7572
})
7673
.resolve(function (err, build, cb) {
7774
if (err) { throw err; }
78-
$scope.safeApply();
7975
cb();
8076
})
8177
.go();
@@ -94,13 +90,11 @@ function ControllerInstanceEdit(
9490
throw new Error('instance not found');
9591
}
9692
data.instances = instances;
97-
$scope.safeApply();
9893
cb();
9994
})
10095
.resolve(function (err, instances, cb) {
10196
if (err) { return $log.error(err); }
10297
data.instances = instances;
103-
$scope.safeApply();
10498
cb();
10599
})
106100
.go();
@@ -125,7 +119,6 @@ function ControllerInstanceEdit(
125119
function (cb) {
126120
fetchUser(function (err, user) {
127121
$scope.user = user;
128-
$scope.safeApply();
129122
cb();
130123
});
131124
},

client/controllers/setup/controllerNew.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ function ControllerNew(
2727
return cb();
2828
}
2929
var orgs = thisUser.fetchGithubOrgs(function (err) {
30-
$scope.safeApply();
3130
cb(err);
3231
var currentOrg = orgs.find(hasKeypaths({
3332
'attrs.login.toLowerCase()': currentUserOrOrgName.toLowerCase()
@@ -73,7 +72,6 @@ function ControllerNew(
7372
fetchUser(function (err, user) {
7473
if (err) { return cb(err); }
7574
$scope.user = user;
76-
$scope.safeApply();
7775
cb();
7876
});
7977
},

client/controllers/setup/controllerSetup.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ function ControllerSetup(
6666
cb(new Error('build already built'));
6767
} else {
6868
data.build = build;
69-
$scope.safeApply();
7069
cb();
7170
}
7271
})
@@ -86,7 +85,6 @@ function ControllerSetup(
8685
fetchUser(function(err, user) {
8786
if (err) { return cb(err); }
8887
data.user = user;
89-
$scope.safeApply();
9088
cb();
9189
});
9290
},

client/directives/accountsSelect/directiveAccountsSelect.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ function accountsSelect (
3434
//
3535
$scope.data.activeAccount = userOrOrg;
3636
$scope.data.instances = null;
37-
$rootScope.safeApply();
3837
$scope.$emit('INSTANCE_LIST_FETCH', username);
3938
$state.go('^.home', {
4039
userName: username

client/directives/activePanel/directiveActivePanel.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ function activePanel(
9696
throw err;
9797
}
9898
delete activeFile.state.isDirty;
99-
$rootScope.safeApply();
10099
});
101100
}
102101
var updateFileDebounce = debounce(updateFile, 333);
@@ -107,7 +106,6 @@ function activePanel(
107106
if (openItems.isFile(last)) {
108107
last.fetch(function () {
109108
last.state.reset();
110-
$rootScope.safeApply();
111109
});
112110
}
113111
}

client/directives/addRepoPopover/directiveAddRepoPopover.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ function addRepoPopover(
9696
// acv
9797
cv.appCodeVersions.create(body, function (err) {
9898
if (err) { throw err; }
99-
$rootScope.safeApply();
10099
});
101100
}
102101
};
@@ -109,7 +108,6 @@ function addRepoPopover(
109108
keypather.set(githubRepo, 'state.selectedBranch', activeBranch);
110109
// reset branch state
111110
activeBranch.state = {};
112-
$rootScope.safeApply();
113111
return activeBranch;
114112
}
115113

@@ -127,14 +125,12 @@ function addRepoPopover(
127125
var instance = instances.models[0];
128126
$scope.repoListPopover.data.instance = instance;
129127
$scope.repoListPopover.data.build = instance.build;
130-
$rootScope.safeApply();
131128
})
132129
.resolve(function (err, instances, cb) {
133130
var instance = instances.models[0];
134131
if (!keypather.get(instance, 'containers.models') || !instance.containers.models.length) {
135132
return cb(new Error('instance has no containers'));
136133
}
137-
$rootScope.safeApply();
138134
cb(err);
139135
})
140136
.go();
@@ -149,12 +145,10 @@ function addRepoPopover(
149145
.query($stateParams.buildId)
150146
.cacheFetch(function (build, cached, cb) {
151147
$scope.repoListPopover.data.build = build;
152-
$rootScope.safeApply();
153148
cb();
154149
})
155150
.resolve(function (err, build, cb) {
156151
if (err) { throw err; }
157-
$rootScope.safeApply();
158152
cb();
159153
})
160154
.go();
@@ -210,7 +204,6 @@ function addRepoPopover(
210204
noStore: true
211205
});
212206
}
213-
$rootScope.safeApply();
214207
// recursive until result set returns fewer than
215208
// 100 repos, indicating last paginated result
216209
if (githubRepos.models.length < 100) {
@@ -230,7 +223,6 @@ function addRepoPopover(
230223
if (err) { return cb(err); }
231224
$scope.user = user;
232225
$scope.repoListPopover.data.user = user;
233-
$rootScope.safeApply();
234226
cb();
235227
});
236228
},

0 commit comments

Comments
 (0)