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

fix: delayed full page reload #7347

Merged
merged 1 commit into from Mar 16, 2022
Merged

fix: delayed full page reload #7347

merged 1 commit into from Mar 16, 2022

Conversation

patak-dev
Copy link
Member

Description

Should fix #7323, but more testing is needed.
This PR is needed regardless of the bug in the Vaadin Starter.

Continuation from

Related fixes

When a rerun has finished and a full-page reload is needed, but we have found new missing dependencies in the process it is better to discard this rerun and delay the reload after a new pre-processing to avoid reloading waterfalls. #6785 tried to do this but the rerun result was still committed (the new esbuild bundled deps written to the cache and the metadata in memory replaced).

After this PR, a rerun is only committed when needed and canceled if the full page reload is delayed. The logic for queueing rerun is also improved.

Note: the general metadata.processing promise is removed since it isn't really needed. If a dependency or dep info is needed, its individual promise should be awaited.

Future work: I think we could simplify the logic of initial optimization / rerun if the initial optimization will be thought of as a scan phase that adds deps to metadata.discovered and a rerun is called afterward. So the scan phase will be more like a speed up way to find missing deps. I think this scan phase could also be done in parallel... it is now blocking the server start, but it could be reworked. This may be important for large apps as the whole user code needs to be traversed by esbuild.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

@patak-dev
Copy link
Member Author

Merging as this is a continuation from the work started in #6758, please still review the change and we can do further modifications while we test the beta

@patak-dev patak-dev merged commit fa0820a into main Mar 16, 2022
@patak-dev patak-dev deleted the fix/delay-page-reload-logic branch March 16, 2022 11:53
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.

LGTM.

Future work: I think we could simplify the logic of initial optimization / rerun if the initial optimization will be thought of as a scan phase that adds deps to metadata.discovered and a rerun is called afterward. So the scan phase will be more like a speed up way to find missing deps. I think this scan phase could also be done in parallel... it is now blocking the server start, but it could be reworked. This may be important for large apps as the whole user code needs to be traversed by esbuild.

Great idea 👍 Was thinking the same too while reviewing this. I think the code has a lot of moving parts now with things running in parallel. Passing around functions was a bit hard for me to grasp the flow, but it was necessary to control it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate loading of the same resource on startup with Vite 2.9 beta1+
2 participants