Skip to content

Commit

Permalink
queue commit only if changed file is pending
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Nov 14, 2023
1 parent 3968a25 commit 2af3410
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/environment-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,14 @@ export default class EnvironmentBase extends EventEmitter implements BaseEnviron
async () => {
debug('Adding queueCommit listener');
// Conflicter can change files add listener before commit task.
this.sharedFs.once('change', queueCommit);
const changedFileHandler = (file: MemFsEditorFile) => {
if (isFilePending(file)) {
queueCommit();
this.sharedFs.removeListener('change', changedFileHandler);
}
};

this.sharedFs.on('change', changedFileHandler);

debug('Running conflicts');
const { customCommitTask = async () => commitSharedFsTask(this) } = this.composedStore;
Expand Down

0 comments on commit 2af3410

Please sign in to comment.