# Application Optimisation
## Approaches
1. PWA
2. Reuse data from store
## PWA
### Cache static assets
- To adapt PWA's app shell architechture to increase the load time of the application. Under this arch, we would cache all static assets (like html, css, js and fonts) to load the base application UI.
- Using service worker, load the static assets from cache.
- Cache screenshots files locally
### Preload assets
- Preload 3rd party libs and css stylesheets to reduce the application load time
### Handling dynamic data
In verifiable app, almost all data are dynamic which changes with time. So caching them won't be a ideal approach.
1. We can store license-types and board sources list locally in IndexedDB, as they only get updated when there is an BE update. Updating the local data can be done by updating the version of service worker.
## Reuse data from store
### Identify APIs that already have data that we need
- Provider list has complete details of all providers, which can be used stored locally. So when fetching for a individual provider and if it is available locally we can use that. Also any change related to this provider should be reflected on the local copy. The local copy gets completely updated only when the entire list get's fetched again.
- The same applies for Alerts list.
### API call only when we need
API should only be call when required.
- License-types and board sources list APIs can be called only when user navigate to settings page or create provider page.
- In datail page, License, DEA and Boards details areavailable within provider details, which can be used instead of separate calls.
- Screenshot can be loaded when user navigated to that specific tabs.
- Provider detail for alerts can be fetched from local copy.
- Entity details for alerts can be fetched from provider's details.
- Alert data in review alert page can be reused from alert list, if exist.
### Prefetch API if needed
> Need invertigation
### Avoid API call if you know there is no data exist
- In provider detail page, if the provider data has no entity in any of the verification. Call to that API can be avoided.