Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debounce reload #4050

Closed
vjpr opened this issue Jan 15, 2021 · 1 comment · Fixed by #4080
Closed

Debounce reload #4050

vjpr opened this issue Jan 15, 2021 · 1 comment · Fixed by #4080
Labels
bug An error in the Docusaurus core causing instability or issues with its execution good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin.

Comments

@vjpr
Copy link

vjpr commented Jan 15, 2021

🐛 Bug Report

In core/src/commands/start.ts the reloader is not debounced and triggers reload for simultaenous file changes.

const fsWatcher = chokidar.watch(pathsToWatch, {
cwd: siteDir,
ignoreInitial: true,
usePolling: !!cliOptions.poll,
interval: Number.isInteger(cliOptions.poll)
? (cliOptions.poll as number)
: undefined,
});
['add', 'change', 'unlink', 'addDir', 'unlinkDir'].forEach((event) =>
fsWatcher.on(event, reload),
);

This is happening to me when I add a new package as node_modules is being (probably mistakenly) watched somewhere. Still, a simple debounce in chokidar should solve it.

Docusaurus website is running at: http://localhost:4000/
Docusaurus website is running at: http://localhost:4000/
Docusaurus website is running at: http://localhost:4000/
Docusaurus website is running at: http://localhost:4000/
Docusaurus website is running at: http://localhost:4000/
Docusaurus website is running at: http://localhost:4000/
Docusaurus website is running at: http://localhost:4000/
Docusaurus website is running at: http://localhost:4000/
@vjpr vjpr added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Jan 15, 2021
@slorber
Copy link
Collaborator

slorber commented Jan 15, 2021

Yes I noticed that already, also happens when you pull from git etc...

We'll add a denounce

(Note you should restart your site on dependency changes)

@slorber slorber added good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. and removed status: needs triage This issue has not been triaged by maintainers labels Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants