feat simplify taskList mixin #728
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
2 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: vikunja/frontend#728
Loading…
Reference in New Issue
No description provided.
Delete Branch "dpschen/frontend:feature/simplify-taskList-mixin"
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?
@ -12,3 +12,3 @@
</div>
<filter-popup
@change="loadTasks"
@change="loadTasks()"
Keeping the parameters of the filter-popup change event in sync with the loadTasks parameters if error prone.
I'm not sure if it was intended here to provide the parameters (didn't check filterPopup).
AFAIK the event parameters are not used, I was just lazy when I added the change listener here.
@ -2,2 +1,3 @@
import TaskCollectionService from '@/services/taskCollection'
import cloneDeep from 'lodash/cloneDeep'
import {calculateItemPosition} from '../../../helpers/calculateItemPosition'
Since the following two functions just calculate some result based on input I removed the definition of them from the mixin in preparation for future composition api.
@ -35,0 +76,4 @@
// Only listen for query path changes
'$route.query': {
handler: 'loadTasksForPage',
immediate: true,
With
immediate: true
the watcher is called on creation -> no additional call necessary inbeforeMount
,created
, etc.Ohhh that's a really nice feature I didn't know.
@ -39,2 +83,2 @@
// is not lost after navigating back from a task detail page for example.
this.loadTasksForPage(this.$route.query)
computed: {
pages() {
By using a computed for
pages
we can spare us the hassle of keeping pages manually in sync and just let the automatic watcher do their job :)@ -51,1 +92,3 @@
) {
loadTasks(givenParams) {
const defaultParams = {
page: 1,
Because a page of
1
is the default I could remove the parameter1
in all the other calls. Need to check if that makes sense.Removed aswell.
@ -60,10 +114,6 @@ export default {
return
}
Tbh I'm not sure if removing the following lines is correct. Don't remember why I did.
Was probably wrong. Removed this
@ -80,58 +130,24 @@ export default {
return
}
In Vue 2 the
$set
function is just needed the for change detection caveats. Directly replacing a reactive data value is not one of those. So no$set
needed (we don't need it anywhere in vue 3).I see, I thought it was required for all things array mutations, not only directly replacing a value in an array.
@ -132,3 +149,1 @@
if (typeof e.search === 'undefined') {
search = ''
}
const page = e.page !== 'undefined' && Number(e.page)
We just assign the params if they have a valid value. In other cases the default their default value is used in the
initTasks
functionProbably also wrong. Removed.
10948a1f62
toe0fe45cceb
e0fe45cceb
toa48f814f56
WIP: feat simplify taskList mixinto feat simplify taskList mixin