Skip to content

Commit f58d511

Browse files
committed
Avoid hanging the application during initial load
Restoration may never resolve, so attempting to await until resolution causes the application to hang.
1 parent ad5ea64 commit f58d511

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/index.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ async function activate(
7474
// Get a reference to the default file browser extension
7575
const filebrowser = factory.defaultBrowser;
7676

77-
// Wait for the application and file browser extension to be restored:
78-
await Promise.all([app.restored, filebrowser.model.restored]);
79-
8077
// Attempt to load application settings
8178
try {
8279
settings = await settingRegistry.load(plugin.id);
@@ -86,8 +83,10 @@ async function activate(
8683
// Create the Git model
8784
const gitExtension = new GitExtension(app, settings);
8885

89-
// Sync the Git extension path with the file browser extension's current path
90-
gitExtension.pathRepository = filebrowser.model.path;
86+
// Whenever we restore the application, sync the Git extension path
87+
Promise.all([app.restored, filebrowser.model.restored]).then(() => {
88+
gitExtension.pathRepository = filebrowser.model.path;
89+
});
9190

9291
// Whenever the file browser path changes, sync the Git extension path
9392
filebrowser.model.pathChanged.connect(

0 commit comments

Comments
 (0)