MuffinTheDragon / daily-habit-tracker

Minimalistic app to help track and build daily habits
https://www.dailyhabits.dev/
57 stars 3 forks source link

Syncing #6

Open mark2185 opened 2 months ago

mark2185 commented 2 months ago

Loving the app so far, I just have a few questions, namely - how often do the completed habits sync across devices?

I'm logged in both on my laptop and on my phone and I could've sworn I've marked some of the habits as completed yesterday, but it ended up consuming a streak freeze today, and I can't get rid of the popups saying "Careful! You missed 1 day(s)..."

I've also marked some of the habits as completed on my laptop this morning, but on my phone they're still unchecked. (I also can't get rid of the notifications there either, I dismiss them, but after I refresh they're there again)

MuffinTheDragon commented 2 months ago

They should sync in basically real-time.

Its possible if you just had the app open in background for a long time, didn't refresh and started making changes, the token may have expired and the data didn't fully sync.

But say you have the app saved on your phone and go back to it a little while later. If you refresh and then mark a habit, it should sync instantly. You may to have to refresh on your other devices

MuffinTheDragon commented 2 months ago

As for the notifications, they'll reappear even if you refresh (assuming the habit hasn't been marked as complete for today).

If you're still facing syncing issues, I can introduce a button in the settings that users can click to send a request and sync their data.

MuffinTheDragon commented 2 months ago

There were some issues with the sync button, but those should be fixed now.

mark2185 commented 2 months ago

I hadn't noticed any issues in the past two days so I guess it could've been a caching issue.

The clarification regarding dismissing notifications and the syncing being in real time do help, thanks! I'd consider this "issue" to be solved.

MuffinTheDragon commented 2 months ago

Hi, re-opening this issue because there indeed was a bug with the syncing, I just never happened to run into it.

What happened was, the calculation for computing streaks and freezes would sometimes run before the data synced from the server. So, as you mentioned, if you checked a task on your phone lets say at 11:59 PM, then opened the app on your laptop at 12:00 AM, if the calculation ran before the data was fetched on your laptop, it would revert the check you made on your phone.

This has now been fixed. But I'll leave this issue open for a bit in case other sync issues pop up. Thanks!