Loomio

Making use of browser cache to reduce load times

DS Danyl Strype Public Seen by 77

I've been noticing that when I navigate to a Loomio thread I'd read before, my browser tries to load the previous version from cache (that what it looks like anyway), but then the Loomio UI takes over and replaces the comments with grey boxes. Then I have to wait for comments I've already read to reload before I can review them. A couple of questions:

  • Is there a way the UI could allow the browser cache to be displayed until the new version of the page is finished loading in the background?

  • Is there a way the UI could diff the current version of the page in the database with the version in cache, and append changes to it without reloading it from scratch, like it does with appending new content to pages on-the-fly once they're loaded?

As an example of a web app that works like kind of like this, check out Pinafore.social , a web client that works with any Mastodon and Pleroma instance. When I navigate to pinafore.social, the app is loaded from browser cache, so it loads fast, and even if I'm offline, I can read any posts and threads that I loaded previously while online. I can also draft a post, although obviously I can't actually post it until I go online. Once I go online, the app will start polling for new content, which will either start to appear automatically, or a button will appear that I can press to load the new content into the UI.

RG

Robert Guthrie Thu 16 Apr 2020 6:44PM

What you're seeing is the server displaying a simple pre-rendered html page (using the app css) instead of the logo loading screen. We do this to show you what we can, while the app takes it's time to load.

The app loads in the background, and as it boots, it keeps the main part of the page content around until it has the data it needs to replace it. But it's not perfect yet.

It can be improved so that there is less visible "loading" stuff, but that will come with a rewrite of the thread page stuff later.

It's not coming from your browser cache.. the app js and css files are, but not the content you're seeing before the app is booted, that's rendered just for you.

DS

Danyl Strype Sat 2 May 2020 1:19PM

@Rob Guthrie

it keeps the main part of the page content around until it has the data it needs to replace it. But it's not perfect yet.

On my system, it greys out the page content well before it has the data it needs to replace it. Sometimes it starts reloading comments on a page that's already finished loading, while I'm scrolling up and down, which is also a bit disruptive to the UX.

RG

Robert Guthrie Sat 2 May 2020 9:57PM

yea, it's not perfect yet. it'll improve

DS

Danyl Strype Sun 3 May 2020 5:55AM

@Rob Guthrie:

yea, it's not perfect yet. it'll improve

Cool. Keep up the good work :)