Skip to content

Commit 9aabb50

Browse files
committed
fix: add delay on widget creation
1 parent 72c93bd commit 9aabb50

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/utils.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ export async function nbgitpullerUpdateButton(
4646
// 1-899 left justified, 900+ right justified
4747
app.shell.add(updateReposBtn, 'top', { rank: rank });
4848

49+
// Wait one second for initial creation timing
50+
await new Promise(f => setTimeout(f, 1000));
51+
4952
// Check for updates
50-
checkForUpdatesAndSetDisplay(repositories);
53+
await checkForUpdatesAndSetDisplay(repositories);
5154

5255
console.log('nbgitpuller-jl-interface settings loaded');
5356
}
@@ -111,7 +114,7 @@ export async function repoUpdateProbe(
111114
console.log("Flim3");
112115
// Create interval
113116
intervalID = setInterval(async () => {
114-
checkForUpdatesAndSetDisplay(repositories);
117+
await checkForUpdatesAndSetDisplay(repositories);
115118
}, probeInterval);
116119
console.log("Flim4");
117120
}
@@ -260,7 +263,7 @@ export async function setUpdateButtonDisplay(
260263
const failed_updates = await makeNbgitpullerRequest(repositories);
261264

262265
// Update widget to all updated or pending updates
263-
checkForUpdatesAndSetDisplay(repositories);
266+
await checkForUpdatesAndSetDisplay(repositories);
264267

265268
// Notify users of any failure
266269
if (failed_updates.length !== 0) {

0 commit comments

Comments
 (0)