PWA question

I understand that content is only updated if connection can be made to the server, but what is the situation if a page normally reads the content from a database (e.g. Datably or Armadillo)? Would the page show the content previously served from the database, or would the page fail to load?

There is very little discussion about PWA on this forum, so this may not be the best place to get the answer.

However, back when PWA was a new thing, I did explore what was involved in creating a PWA version of a site, and I was surprised how relatively easy it was to create a PWA, but as is often the case, creating a PWA site may be easy but the devil will be iding deep in those details. I would think that from the DB side, using a database would allow access to the tools to flag what’s changed.

When to refresh content and select what content should be a big part of those details if you are to make good use of PWA.

This site was a quick google and I certainly found it useful and thought provoking - https://plainenglish.io/blog/how-to-force-a-pwa-to-refresh-its-content

2 Likes

I use PWA Pro stack on a few sites and works really well so long as setup correctly, sometimes you have to be sure to republish all files or visit the manifest page itself to ‘activate it’ kind of giving it a kick start, not always but sometimes. I’m only guessing here, but I would imagine for a blog that is derived from a mysql database that if there is no connection then the page structure and associated components should load as cached but the dynamic content of the blog will likely show as no connection. That is just a best guess though and may be wrong, if you are using Joe’s PWA Pro then you would probably best ask on the Weaverspace community site. Twitter is a PWA so that gives you an idea of dynamically loaded content without a connection. If you use something that isn’t pulling data in external and is part of the project file such as Poster stack or RW blog then it should all work offline.

1 Like

Thanks Ben. That is pretty much what I thought would happen too, but I was just hoping someone had tried this and could give a definitive answer.

1 Like

I can’t remember how Armadillo works exactly when a post is added, but whether it triggers a page refresh or not would be worth finding out. Also you may only need the recent posts instead of the whole blog.

2 Likes

That’s pretty much what I thought, thanks. I guess it all depends if data is accessed via php before html page is constructed, or JSON in page.

To just to quote myself here, you also have to factor in all of this that only when something has already been loaded in will it be cached enabling offline use later, so it would mean that every post would need to be loaded in (or viewed) in order to enable offline viewing. This is very unlikely with a blog. The only way to force caching of non-loaded content is to list every element in the PWA, which is an impossible task as it means making a list of elements from the largest image down to the smallest css file needed for content. Then of course when you add a new post every element needed for that post will be need to be added to the list, essentially you are talking about many unrealistic hours. So in short I think that firmly gives an answer that you will need an active internet connection for you PWA blog in order for it to retrieve blog posts, if not then you will get unable to load messages or response from the browser. A huge benefit from the PWA though, as you know I’m sure, hence the reason for looking in to this, is that it does look and feel like an app and installs as an ‘app’ on the homescreen and you don’t get the browser clutter of toolbars, address bars etc, just the clean app interface. So a bit like BBC News or Sky News app for your blog, that is expecting a net connection for dynamic content.

Great for static sites if it is intended for offline use as well as online use, but dynamic content will need a net connection.