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.
This is a solution to using the Angular Router to avoid client side requests.
The way it achieves this is to preload the website data by running a prefetch process in Node when building the site.
This solution is comprised of 3 main files, one of which is already present in the base branch
angular-ssr
prerender-routes.ts
- generates an agility-routes.txt file for Angular to prerender the page contentprerender-pages.ts
- generates a JSON file of all your Agility Pages, effectively a Sync mechanismprerender-content.ts
- generates a JSON file of all the content lists you requireComponent Retrofitting
In order to pull data client side components have to be updated to first check the local JSON files and then set that as the initial TransferState.
Development Caution
This has not been tested on websites with a large volume of pages or content lists. Anything pre-rendered will in-fact add to the build times of the application.
As well, since the Angular Router is held within memory, all preloaded data is also held within memory adding to the application overhead.