Cache JSON data
Related to gitlab-org/gitlab#349613 (closed)
This MR adds PWA back to use the service worker (via Workbox) to cache data files.
- Data files are now versioned, creating a new version when
bin/build
. - Data files are fetched from the cache after the first load. As a limitation, it requires restarting the nuxt server after generating new files, I tried to make it as dynamic as possible though. That being said, the recommendation is to test it on production. And even without the cache, the pages are working quickly and as expected.
Screenshots
How to set up and validate locally
Regenerate and print current hash:
bin/build && cat web/static/data/manifest.json
To --brute-force-- restart the built-in server. On /web
.
yarn build && yarn generate && yarn start
Edited by Axel García