Skip to content

Commit

Permalink
fix: chain extract on watched file changes (#1435)
Browse files Browse the repository at this point in the history
  • Loading branch information
taozhou-glean authored Feb 14, 2023
1 parent 3de0811 commit 5dd50d3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/cli/src/lingui-extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,14 @@ if (require.main === module) {

const changedPaths = new Set<string>()
let debounceTimer: NodeJS.Timer
let previousExtract = Promise.resolve(true)
const dispatchExtract = (filePath?: string[]) => {
// Skip debouncing if not enabled
if (!program.debounce) return extract(filePath)
// Skip debouncing if not enabled but still chain them so no racing issue
// on deleting the tmp folder.
if (!program.debounce) {
previousExtract = previousExtract.then(() => extract(filePath))
return previousExtract
}

filePath?.forEach((path) => changedPaths.add(path))

Expand Down

1 comment on commit 5dd50d3

@vercel
Copy link

@vercel vercel bot commented on 5dd50d3 Feb 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.