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: expose pendingReload to consumers #4101

Closed
wants to merge 1 commit into from

Conversation

schalk-b
Copy link

@schalk-b schalk-b commented Jul 3, 2021

Description

Implements #4100

Expose pendingReload to consumers

At the moment, when I run a Jest test for the first time, when unoptimized dependencies are discovered the server gets flagged to do a "reload", where it optimize the dependencies and re-bundles the cache.

This results in tests failing, because they are unable to resolve dependencies in the cache while things are reloading.

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 Commit 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.

@patak-dev
Copy link
Member

This looks like an interesting feature. We'll discuss it next week with the team.

@schalk-b
Copy link
Author

schalk-b commented Jul 3, 2021

Thank you, I'm also not completely convinced that this is the best solution to the problem. There might be better way to address #4100

@patak-dev patak-dev added the p2-nice-to-have Not breaking anything but nice to have (priority) label Jul 6, 2021
* A promise which will resolve once a reload is complete. A reload is
* pending as a result of optimizing missing dependencies.
*
* When no reload is pending it will be null.
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to note here that the pendingReload field might be refreshed. That is, if the user visits a new route, and new dependencies are discovered, it may be re-assigned with a new Promise.

@schalk-b
Copy link
Author

I don't think this is the right solution to the problem. This doesn't handle with concurrency / locking of the .vite directory.

@schalk-b schalk-b closed this Jul 16, 2021
@haoqunjiang haoqunjiang mentioned this pull request Dec 9, 2021
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants