I am running a next.js application for serverside rendering on google cloud functions through firebase hosting rewrites. Together with caching, this works extremely well. However, when the cache is expired or a certain route is not yet cached one may encounter quite a bit of latency due to a function cold start since the function has not been invoked for a certain time. I am wondering if there is any elegant way to serve a loading view (e.g. a simple .html file) during the function boot-up so the user doesn't have the feeling that his connection is down or the page is not loading.
Any suggestions are welcome.