Skip to content

web: enable `apollo-cache-persist`

Administrator requested to merge vb/apollo-cache-persist into main

Created by: valerybugakov

Context

We have a couple of API queries required for every page in the web application to start: extensionsRegistry and viewerSettings. They are quite slow and block the rendering of the app on different stages, which is bad for performance. Because data returned by these API requests don't change frequently we can leverage client-side persistent caching to prevent render-blocking. This PR enables local storage caching via Apollo-Client plugin for three queries: 'viewerSettings', 'extensionRegistry', 'temporarySettings'. The cached data is still updated in the background: cache-and-network fetch policy is used. Query names to persist are hardcoded for now. This aspect will be improved in a separate issue: #25035.

Changes

Timelines

Screenshots from development build. See how cached queries don't delay the execution of subsequent requests.

Request waterfall

Before

Screenshot 2021-09-16 at 13 55 55

After

Screenshot 2021-09-16 at 13 55 46

Performance tab

Before

Screenshot 2021-09-16 at 13 58 11

After

Screenshot 2021-09-16 at 13 58 24

Merge request reports

Loading