Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?