okTurtles / group-income

A decentralized and private (end-to-end encrypted) financial safety net for you and your friends.
https://groupincome.org
GNU Affero General Public License v3.0
329 stars 43 forks source link

PWA issues ... logged in client doesn't recover if server state was cleared #2017

Open taoeffect opened 4 months ago

taoeffect commented 4 months ago

Problem

On mobile, when accessing the testing website, after a server wipe, I couldn't login again even though I had logged in with the correct username and password. I was able to login to the website briefly, but it got stuck at "loading events from server" in the PWA. And when using just the browser on mobile, it gave me some error (showing an old group hash).

There was no way to recover from this situation without going into the browser's settings and telling it to delete the site's data.

Duplicate issue #2021 shows the symptoms of this issue:

After signing in via the PWA to the testing site, it just sits there:

tmp-1716601067905

EDIT: this is in Vanadium on GrapheneOS.

After force-quitting the PWA and re-running, now it's stuck here:

Screenshot_20240524-194504

Then in the web browser after refreshing it says:

tmp-1716605186631

Solution

It's unclear what's going on. I got these errors in the PWA for both Brave and Vanadium, supposedly two different browsers. Are they sharing the same stale data somehow or is this a totally different error?

For now, make it so that the user is just logged out in this situation and the local state is reset by the client.

In the future, we'd prefer to preserve the state so that it's possible to recover it and migrate to a different server, but for now resetting the state is better than not being able to use the app at all.

See related issues:

taoeffect commented 4 months ago

OK, I have confirmed now that this is due to residual old data from the PWA from the previously created group (that got wiped).

Interestingly, this seems to be an issue specifically with PWAs, and also on Android it seems to affect things in a cross-browser way. In other words, even though I'd never installed a PWA for the testing site via Vanadium before (but had done it with Brave), the Vanadium-installed PWA had the exact same problem.

Setting up a totally new website under a different domain "fixed" the issue. But the real fix needs to be to reset the app's data some way so that this doesn't happen.