element-hq / element-web

A glossy Matrix collaboration client for the web.
https://element.io
GNU Affero General Public License v3.0
11.2k stars 2k forks source link

Use service worker to cache assets #7984

Open krombel opened 5 years ago

krombel commented 5 years ago

When the browser is on an unstable connection (or reconnecting after system resume) it sometimes wants to load resources which are not available at that moment but are part of riot (e.g. emoji).

Sometimes this leads to design issues which I normally "fix" by reloading riot entirely but on slow connections that is not always the best idea.

A better idea would be to use the caching mechanics of service workers. It can be as simple as this example. Later it probably can be extended by some push mechanism.

I would extend that example by avatars (so URLs with <server>/_matrix/media/v1/thumbnail/<server>/<hash>) with some fallback if fetching fails.

This would especially allow Riot to be usable even if network connection is lost.

turt2live commented 5 years ago

Related: https://github.com/vector-im/riot-web/issues/7932