Skip to content

Commit

Permalink
- debounce manifest change check (#919)
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksandrDemian authored Sep 26, 2022
1 parent 2b836a8 commit 7158370
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/commands/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ export default async (options: CommandOption): Promise<void> => {
console.log(LOG.PUSH_WATCH);
// Debounce calls to push to coalesce 'save all' actions from editors
const debouncedPushFiles = debounce(async () => {
if (!options.force && (await manifestHasChanges(projectSettings)) && !(await confirmManifestUpdate())) {
console.log('Stopping push…');
return;
}

console.log(LOG.PUSHING);
return pushFiles();
}, WATCH_DEBOUNCE_MS);
Expand All @@ -53,10 +58,6 @@ export default async (options: CommandOption): Promise<void> => {
return;
}
console.log(`\n${LOG.PUSH_WATCH_UPDATED(filePath)}\n`);
if (!options.force && (await manifestHasChanges(projectSettings)) && !(await confirmManifestUpdate())) {
console.log('Stopping push…');
return;
}
return debouncedPushFiles();
};
const watcher = chokidar.watch(rootDir, {persistent: true, ignoreInitial: true});
Expand Down

0 comments on commit 7158370

Please sign in to comment.