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

feat: allow passing down "null" to disable server watcher #14208

Merged
merged 8 commits into from
Sep 19, 2023

Conversation

sheremet-va
Copy link
Member

@sheremet-va sheremet-va commented Aug 27, 2023

Description

Fixes #14189

Providing null in server.watch config option (similar to build.watch) now disables the watcher altogether.

Additional context

This helps with watch leaks in Vitest.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@stackblitz
Copy link

stackblitz bot commented Aug 27, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@AriPerkkio
Copy link
Contributor

I built some test cases earlier today. Check the playground/watch: AriPerkkio@16162d6

bluwy
bluwy previously approved these changes Sep 4, 2023
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

+1 for this feature. This is also useful for Astro as it spins up a one-off server to load the config, and watching would be disabled.

Have one nit below.

docs/guide/api-javascript.md Outdated Show resolved Hide resolved
@patak-dev patak-dev added the p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority) label Sep 4, 2023
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
bluwy
bluwy previously approved these changes Sep 11, 2023
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

IIRC in the last meeting we're ok with this as it doesn't change how plugins interact with the watcher (much).

@bluwy
Copy link
Member

bluwy commented Sep 15, 2023

The watcher test is a little unstable so I updated it. It's more naive but I think probably good enough.

@bluwy bluwy merged commit af5a95e into vitejs:main Sep 19, 2023
11 checks passed
@sheremet-va sheremet-va deleted the feat/allow-disable-watcher branch September 19, 2023 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow disabling watcher altogether
4 participants