electric icon indicating copy to clipboard operation
electric copied to clipboard

Update examples to use Vita PWA for full offline support in the browser.

Open thruflo opened this issue 1 year ago • 6 comments

We switched to Vita as the bundler for our examples partly because then it's trivial to use https://vite-pwa-org.netlify.app to make them work fully offline (i.e.: the page loads even when refreshed / loaded when offline).

We haven't done this yet, as per:

image

Let's do it.

thruflo avatar Nov 20 '24 13:11 thruflo

👀 I have a bit of phobia of service workers from a lot of painful scars in the past. Maybe just keep the examples bare bones to avoid extra layers that we need to debug?

KyleAMathews avatar Nov 20 '24 13:11 KyleAMathews

The benefit is fairly large here: we can demonstrate working offline systems which is a key benefit of Electric sync.

I'm under the impression that https://vite-pwa-org.netlify.app/guide/ abstracts this for us and we just include their generated manifest etc. and it just works. Do you think that it won't / will we hit issues because of this?

thruflo avatar Nov 20 '24 14:11 thruflo

We had a lot of issues with service workers at Gatsby and while Google pushed the various PWA technologies really hard in the mid 2010s, they by and large haven't been adopted by the industry as they can cause a lot of trouble as SW are permanently installed on clients and almost impossible to get rid of if you make certain mistakes.

Perhaps vite-pwa has solved all the problems and it's trivial to use but... I suspect not.

That being said, I agree it'd be nice to demo as people will want to see it — how about we just add it to one example and see how it goes? E.g. the tanstack one as that's the only one that has offline write support atm as well.

KyleAMathews avatar Nov 20 '24 14:11 KyleAMathews

Yup, maybe the big linearlite that Sam's working on merging instead / as well? That's a key one that we demo and would be nice to show working fully offline (unlike Linear!).

thruflo avatar Nov 20 '24 14:11 thruflo

😂 we'll rename it to linear-better 😎

KyleAMathews avatar Nov 20 '24 14:11 KyleAMathews

@samwillis fancy vite-pwaing up big linearlite whilst you're there?

thruflo avatar Nov 20 '24 15:11 thruflo