NotAvailableN
Convex Community5mo ago
25 replies
NotAvailable

How to remove the desync between the convex backend and frontend

I send that _creationTime of a document to the frontend. In the frontend, I display how much time has passed since that document was created, by subtracting the now date in frontend - the date from the backend. The problem is that for the first 1-2 seconds, the timer is negative, like this document was created -1 seconds ago, but in after a sec, it goes back to positive. How do I properly sync the times between the convex db and the frontend date.now() ? Is there a trick? I am thinking of just displaying a false timer in the frontend, by checking if the time difference is less then zero and manually shifting it to be positive and continue from there. Is there any solution thats more elegant though?
Was this page helpful?