Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data is lost after leaving the app open for a long time #81

Open
2 tasks done
slfhstr opened this issue Jan 23, 2025 · 3 comments
Open
2 tasks done

Data is lost after leaving the app open for a long time #81

slfhstr opened this issue Jan 23, 2025 · 3 comments
Labels
invalid This doesn't seem right

Comments

@slfhstr
Copy link

slfhstr commented Jan 23, 2025

I've found a bug and checked that ...

  • ...there are no open or closed issues that are related to my problem
  • ...it's definitely a bug and not a feature request

Description

I have had a few occasions when data entered "disappears" meaning that all income and expenses entered is lost and the default 'demo' list of groups and line items are displayed (with zero values).
First time it happened, I thought oh well, maybe I was mistaken and it's been a while since using the system, maybe the container was brought down.
Fortunately I had an export of data in json and reloaded.
Then happened couple of times more, and just happened again with definitely no changes to the VPS where it is hosted.
Was working on data yesterday, left the browser window open, this morning all data gone and default empty groups and line items displayed.
Regular enough occurrence now that it should be considered a bug.
It's almost as if Load demo data got called, but demo data has some line items with values, whereas the behaviour I have seen loads blank data.

Is it related to a timeout when user is logged out although browser window is left open ? Maybe.
But logging back in should restore the data, and this does not happen (for me)

Environment

  • Browser : Safari 18.2 (not tested in other browsers)
  • OS : Mac Sequoia 15.2
  • Ocular : app about shows 1.5, but docker compose shows frontend 1.7 and genesis 1.4 and nginx 1.26
  • VPS : Ubuntu 24.04

NAMES STATUS IMAGE CONTAINER ID PORTS ocular-nginx Up 4 minutes nginx:1.26-alpine db9f27c86835 0.0.0.0:3030->80/tcp, [::]:3030->80/tcp ocular-backend Up 4 minutes (healthy) ghcr.io/simonwep/genesis:v1.4.0 e0986f858b6c ocular-frontend Up 4 minutes (healthy) ghcr.io/simonwep/ocular:v1.7.0 5ab659523935 80/tcp

Expected behaviour

Data should persist

Steps to reproduce

Open app
Enter data
leave browser window open for some time

Additional info

Would be cool if data could be auto-saved
Browser / OS constraints probably mean this cannot be saved to local file, but maybe some 'data snapshot' could be saved to the server as additional safeguard (user may not explicitly export as json after data changes).
I guess this last bit counts a feature request, but the core problem is a bug.

@simonwep
Copy link
Owner

Hey! Sorry to hear that, this is really strange. I'll take a closer look at it later today. To get this right, you are logged in with your data, come back later and you are still logged in and all data is gone? Or are you logged out and all data is gone? Because the latter is expected behaviour as you were inactive and the session may be expired. After logging back in all data should be there as you left it - but that's not the case?

That the demo data is displayed is also very, very strange as it's only done if you, well, click the button in the menu. Are you sure the app loaded the demo data? And did this happen while you were logged in? There's only one case where the demo data is loaded if you're not logged in, and that is when you open https://ocular.reinisch.io/#demo (notice the #demo at the end) - any chance you open the app by that url? It'd still be a bug but help me with debugging that.

Should be fairly simple to reproduce later by using a very short-lived session and waiting.

@simonwep simonwep added the unclear Needs clarification label Jan 23, 2025
@simonwep simonwep changed the title Data loss Data is lost after leaving the app open for a long time Jan 23, 2025
@slfhstr
Copy link
Author

slfhstr commented Jan 23, 2025

To get this right, you are logged in with your data, come back later and you are still logged in and all data is gone?
Yes

After logging back in all data should be there as you left it - but that's not the case?
No. I get an extensive list of groups and line items in groups, but without values.
It's not exactly demo data, because that has some values on some line items

I am monitoring and will try to take some screenshots (was rushing earlier to recover situation)

@simonwep
Copy link
Owner

@slfhstr okay, I just had time to check a few things:

  1. That your frontend is displaying v1.5.0 is correct, ocular is a PWA and will only "update" itself if you reload twice (first to notice the update, secondly to apply it). For example, if you haven't opened it yet - https://ocular.reinisch.io is using the latest version and shows it in the info modal as well. You will have to refresh the page at some point. Otherwise you'll be using the first using the browser got to see forever 😅
  2. That demo data is loaded over your data is, considering the two places where it's loaded, highly unlikely. The only thing where this might be possible is when you open the page with #demo and you get logged in before the demo data is loaded. I couldn't reproduce that either, anyway I added an additional check for that in 6159628 to rule it out completely. But who knows, I'm open for surprises haha
  3. I tried to reproduce the scenario, opening a window, logging in, closing the laptop and waiting until the session expires (I configured a minute locally) and opening the laptop again. I was still logged in as normally nothing is done when the session "expires" because that's not even tracked nor is the session refreshed or something with the server communicated when you're not doing anything like entering data. When I tried to enter some data I got logged out but saw all my data again when I logged back in.

So far no luck reproducing your scenario :/ What would help me would be a step-by-step description of what you are doing like I did in 3. but with timing information, maybe even using the latest version will solve this.

Also, Apple is really against all this PWA stuff, switching to Chrome or Firefox would definitely help - although I'm not doing any crazy stuff, but I personally avoid using Safari at all because of stuff like that (not saying that this app doesn't support it, just that there's so much "hidden" stuff apple is doing that I don't want to spend time researching it) 😅

@simonwep simonwep added invalid This doesn't seem right and removed unclear Needs clarification labels Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants