Skip to content

Commit e230b08

Browse files
committed
fix: init git only after all git modules load to not miss git events
1 parent 6606f5e commit e230b08

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

src/extensions/default/Git/main.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,19 @@ define(function (require, exports, module) {
4040
}
4141

4242
AppInit.appReady(function () {
43-
Main.init().then((enabled)=>{
44-
if(!enabled) {
45-
BracketsEvents.disableAll();
46-
}
43+
function initMain() {
44+
Main.init().then((enabled)=>{
45+
if(!enabled) {
46+
BracketsEvents.disableAll();
47+
}
48+
});
49+
}
50+
// Main.init emits events like GIT_ENABLED that the modules above listen
51+
// for. They load asynchronously, so init must wait for them or events
52+
// fired before they finish loading are lost (Eg. empty remotes picker).
53+
require(modules, initMain, function (err) {
54+
console.error("Git modules failed to load, initializing git anyway", err);
55+
initMain();
4756
});
4857
});
4958

0 commit comments

Comments
 (0)