feat: make time reactive #2627

Open
dpschen wants to merge 1 commits from dpschen/vikunja:feat/reactive-today into main
Member
No description provided.
dpschen added the
kind/feature
label 2024-07-18 12:27:11 +00:00
dpschen added 1 commit 2024-07-18 12:27:54 +00:00
feat: make time reactive
Some checks failed
continuous-integration/drone/pr Build is failing
ad7148c448
dpschen reviewed 2024-07-18 12:35:44 +00:00
@ -200,3 +201,2 @@
const today = ref(new Date())
onActivated(() => today.value = new Date())
const today = useNow({interval: 1000})
Author
Member

Since this is only used to update the current highlighted day it makes sense to update this live.

Since this is only used to update the current highlighted day it makes sense to update this live.
dpschen force-pushed feat/reactive-today from ad7148c448 to aa427a8cfa 2024-07-18 14:49:27 +00:00 Compare
Member

Hi dpschen!

Thank you for creating a PR!

I've deployed the frontend changes of this PR on a preview environment under this URL: https://2627-feat-reactive-today--vikunja-frontend-preview.netlify.app

You can use this url to view the changes live and test them out.
You will need to manually connect this to an api running somewhere. The easiest to use is https://try.vikunja.io/.

This preview does not contain any changes made to the api, only the frontend.

Have a nice day!

Beep boop, I'm a bot.

Hi dpschen! Thank you for creating a PR! I've deployed the frontend changes of this PR on a preview environment under this URL: https://2627-feat-reactive-today--vikunja-frontend-preview.netlify.app You can use this url to view the changes live and test them out. You will need to manually connect this to an api running somewhere. The easiest to use is https://try.vikunja.io/. This preview does not contain any changes made to the api, only the frontend. Have a nice day! > Beep boop, I'm a bot.
konrad requested changes 2024-07-19 07:45:00 +00:00
@ -127,3 +129,3 @@
import BaseButton from '@/components/base/BaseButton.vue'
const exampleDate = formatDateShort(new Date())
const now = useNow({ interval: 1000 })
Owner

Can you use a higher interval? 1 or 10 minutes should be plenty.

Can you use a higher interval? 1 or 10 minutes should be plenty.
Author
Member

This will tick once every 1000ms. Only if the component is open with the purpose of updating the example. So E.g. if the date changes after 23:59 it will immediately show the new date.

If we only update once every minute it will not be in sync and the joke is gone.

useNow without the interval uses requestAnimationFrame which is relative to a setTimout 'demanding'. For this usecase here I think it totally makes sense to update every second especially given that we only update if the view is open.

This will tick once every 1000ms. Only if the component is open with the purpose of updating the example. So E.g. if the date changes after 23:59 it will immediately show the new date. If we only update once every minute it will not be in sync and the joke is gone. `useNow` without the interval uses `requestAnimationFrame` which is relative to a `setTimout` 'demanding'. For this usecase here I think it totally makes sense to update every second especially given that we only update if the view is open.
Owner

I think if we update within 1 minute of that happening, it will be fine. Most users' time setting is off by a few settings anyway and most OSes show the time only in minute intervals.

I think if we update within 1 minute of that happening, it will be fine. Most users' time setting is off by a few settings anyway and most OSes show the time only in minute intervals.
Author
Member

most OSes show the time only in minute intervals
That is true, but we don't know when that interval changes. I guess the worst case would be 59s apart. I don't see why we shouldn't update 'in that instant' meaning in the second that the system clock switches.

I plan my tasks for the next day quite often around midnight and I would expect the time to update in sync.

`most OSes show the time only in minute intervals` That is true, but we don't know when that interval changes. I guess the worst case would be 59s apart. I don't see why we shouldn't update 'in that instant' meaning in the second that the system clock switches. I plan my tasks for the next day quite often around midnight and I would expect the time to update in sync.
Owner

I think updating every second uses too much resources for not much benefit.

I think updating every second uses too much resources for not much benefit.
@ -200,3 +201,2 @@
const today = ref(new Date())
onActivated(() => today.value = new Date())
const today = useNow({interval: 1000})
Owner

Same here for the update interval.

Same here for the update interval.
Author
Member

Similar here:

If the date switches we want to update at least in that second.
Else I think it doesn't really make sense.

Similar here: If the date switches we want to update at least in that second. Else I think it doesn't really make sense.
All checks were successful
continuous-integration/drone/pr Build is passing
Required
Details
This pull request has changes conflicting with the target branch.
  • frontend/src/components/tasks/partials/KanbanCard.vue

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u feat/reactive-today:dpschen-feat/reactive-today
git checkout dpschen-feat/reactive-today
Sign in to join this conversation.
No Reviewers
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vikunja/vikunja#2627
No description provided.