Description
When using a saved filter (List View) in Vikunja, the ordering of tasks across multiple pages is incorrect. Specifically, tasks are not appearing on the expected pages based on their position
property.
This issue does not occur in the regular List View (without saved filter). It is also not reproducible on **try instance **because it does not have Typesense enabled.
Expected Behavior
- Tasks should be ordered by
task.position
on both pages. - When a task that was not previously displayed in the saved filter starts satisfying the filter condition, it should receive position = 0 (under question) and appear on the 2nd page.
- When a task that was previously displayed and ordered in the saved filter disappears and later reappears, it should retain its original position on the 1st page, pushing the last task on the 1st page to the 2nd page.
- The 2nd page should maintain the same ordering logic as the 1st page, showing tasks with highest positions first and tasks with position = 0 at the end (under question).
Actual Behavior
- The 2nd page does not update correctly and continues to display certain tasks that should now appear on the 1st page.
- The 1st page maintains correct order but skips tasks that should be displayed, instead showing them on the 2nd page.
Steps to Reproduce
- Create a saved filter in Vikunja.
- Populate the list with more than 50 tasks to trigger pagination.
- Observe task order changes when new tasks are added or existing tasks naturally disappear and reappear.
- Check if tasks with position = 0 are consistently placed at the end of the 1st page.
- Notice that tasks that should appear on the 1st page are instead displayed on the 2nd page, breaking the expected behavior.
Environment
- Vikunja:
v0.24.1-773-66293795e7
(latest changes frommain
branch) - Typesense:
v27.1
- Redis:
v7.4.0
- DB:
MariaDB vLTS
Potential Cause
A likely cause is the following commit: fix(typesense): do not try to sort by position when searching in a sa… · go-vikunja/vikunja@e56b223 · GitHub
This commit removes sorting by position for saved filters, stating:
“Do not try to sort by position when searching in a saved filter. This change fixes a bug where Typesense would try to sort by the project view of a saved filter. The view position is not indexed in Typesense, hence filtering fails. Because sorting by position is not a feature in saved filters, I’ve removed the logic for sorting saved filters with Typesense.”
However, Typesense does appear to index different view positions within the task collection, including views under saved filters.
Workaround/Fix
When replaying Typesense request and replacing the default sort_by
parameter (done(missing_values:last):asc,created(missing_values:last):desc
) with:
positions.view_179(missing_values:last):asc
Sorting works correctly again.
Additionally, commenting out the following section restores the expected behavior:
# task_search.go:592 (or somewhere near)
/*if opts.isSavedFilter && param.sortBy == taskPropertyPosition {
continue
}*/
Additional Notes
- This issue only affects saved filters.
- Regular List View does not experience this problem, even though new tasks still receive position values by default.
- It appears that Typesense is aware of different view positions, contradicting the commit’s claim that “The view position is not indexed in Typesense.”