Further optimize initial page load by leveraging preboot #1760
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.
References
Description
This PR introduces Angular
prebootas a next step in improving initial page load performance in production mode.The main improvement in this PR concerns the transition from server-side to client-side rendered HTML on lazily-loaded pages (e.g.
/search,/items/...etc.)Instead of blanking out the page while it is being replaced,
prebootbuffers the CSR page in the background while the SSR page is still visible and only replaces it once the app is completely done loadingThis results in significantly smoother page loads
Changes:
Added
prebootFixed some minor compatibility issues between DSpace and preboot
ApplicationRef.isStablemore reliable (preboot depends on it)Fixed some minor bugs with the navbar search box & admin sidebar
Added an animation to make it more clear when the application is still loading. IMO this can help a lot with understanding that e.g. events may not come through
More of a proof-of-concept for now, feedback is greatly appreciated!
Caveats / further work:
prebootcurrently doesn't support Angular 13 without a workaround that hasn't been merged yetprebootitselfprebootis to capture interaction events on the SSR page and replay them once the CSR page is loaded. However, fully integrating this would require more time. See Enable preboot event replay for shorter apparent TTI #1761 for more information.Instructions for Reviewers
Compare initial load perfomance in production mode between this PR and current
mainin different browsersStart from a blank page
Open any lazily-loaded DSpace page (try this for multiple pages, while logged in and not)
/search?q=.../communities/...Do the same on https://demo7.dspace.org/home and compare for "smoothness"
In the current build, the page will blank out for a moment while rendering.
This PR should significantly improve this
Currently there is a glitch when loading or refreshing pages while already logged in; the SSR page accounts for the admin sidebar as if it was pinned, while it can't be.
This PR should eliminate this bug.
Hard refresh the page and compare in the same way. Note that the "feel" can be quite different between these two cases -- when loading from a blank page the flashing tends to be more noticeable
Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
yarn run lintpackage.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.