Refresh tasks lists after a task has been updated #3068
No reviewers
Labels
No Label
area/internal-code
changes requested
confirmed
dependencies
duplicate
good first issue
help wanted
hosting
invalid
kind/bug
kind/feature
question
wontfix
No Milestone
No project
No Assignees
4 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: vikunja/frontend#3068
Loading…
Reference in New Issue
No description provided.
Delete Branch "ThatHurleyGuy/frontend:reload-tasks-updates"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Repro Steps
To
ofnow+12h
Expected
The task is completed and is removed from the list since the next due date is greater than
now+12h
Observed Behavior
The task stays in the list, but is just updated to show the next due date. The filters aren't reapplied
Proposed Solution
When a task is updated, reload the list. This will ensure that any filters (due date, search, etc) are properly applied.
@ -272,1 +272,4 @@
sortTasks(tasks.value)
// After a task has been updated, reload tasks to ensure filters are applied to any changes
loadTasks()
An extra API call isn't ideal, but I would say it's worth the better user experience. Could try to make it smarter and only reload if the updated tasks changed a field that is currently being filtered on (e.g. if the task title is updated and the only active filter is on due date, don't bother reloading), but that seemed like it would be a little overly complicated.
Also, I just put this in
ListList
since it was the easiest spot to shim in. Might make more sense to have some sort ofwatch
inuseTaskList.ts
to see if a task is updated and reloading there. But not being super familiar with vue, I wasn't sure the best way to tackle that sort ofwatch
without getting into infinite loop trouble. Happy to try and work that out if you'd prefer that and are willing to give me a few pointers.It's not perfect, but I think it's a good position for this kind of fix. We have some updates that need to get rebased and merged that should improve this overall mechanism.
Could you prefix the comment with a
FIXME:
?Then I'm happy to merge it :)
I think this is not great for UX, as it shows a full loading spinner every time the tasks are refreshed. A better idea would be to only do this if tasks changed, where any of the dates changed. (that would be a lot more complicated though)
Or maybe only if a task was changed which is repeating 🤔
Probably it would then make sense to rebase that old branch.
Really good catch on the loading spinner. Since I'm hosting it locally and the backend you built is so fast, I never even noticed that :)
Yeah we could make this a more targeted check, but since you can filter on assignee/labels/taskname/etc I think the check basically turns into "Reload the list if any filterable field on the task changed, which is basically any field". So maybe the better tactic would be "check for any active filters, and reload if the task updated a field covered by one of those filters", which is even more complicated :( My only use case is for repeating tasks though, so could just ignore the other fields and only update if it's a recurring task
Does seem like the spirit of that other PR to move more of the filtering into the client would be a good solution for this though
At the end of the day, that's what we should do. It should avoid doing that if the default filters are active though.
That's on hold as we plan to change how filters work in general.
Gotcha, that all makes sense. Thanks for the detail!
If this little bug isn't bothering anyone else and there's a plan to rework filters in general, I can just keep my hack on a separate fork and we can close this PR
I'll keep an eye on updates to the codebase, but in the meantime if you ever want an extra set of hands on anything feel free to @ me and I would be happy to try and help out
Great, will do!
Hi ThatHurleyGuy!
Thank you for creating a PR!
I've deployed the changes of this PR on a preview environment under this URL: https://3068-reload-tasks-updates--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 somehwere. The easiest to use is https://try.vikunja.io/.
Have a nice day!