instant-multi-page-app
instant-multi-page-app copied to clipboard
/blog endpoint may just show "Loading postings..."
Hi, I love this demo you made. I think it's great how it illustrates that you can make a webapp with offline navigations that doesn't rely on a client-side router.
I noticed that for the /blog/
endpoint, it's possible for it to get stuck just showing "Loading postings...":
Steps to repro:
- Open a private/guest window
- Navigate directly to https://instantmultipageapp.com/blog/
This also works if you load the home page in a private/guest window, and then very quickly click on "blog."
I assume the service worker is looking for a cached response and not finding it, because the cache has not been populated yet?
I also noticed this bit of client-side code for loading the blog posts… Is this strictly necessary, if HTML is streamed from the service worker?
https://github.com/DannyMoerkerke/instant-multi-page-app/blob/c291425760b8a554a4721a554faf207654a4315e/blog/index.html#L45-L57
Again, great demo! Love the use of ReadableStreams as well. :slightly_smiling_face:
Hi Nolan, thanks for reporting! Love your blog as well.
I'm looking into this now.
Just fixed the issue.
The problem was that when /blog is directly visited and the Service Worker is not activated yet, it cannot load the cached response yet. The bit of client-side code you mentioned is actually meant to fetch the postings for exactly this situation, however, it wasn't loaded so the postings were not fetched.