# Subtasks show on different pages

**URL:** <https://community.vikunja.io/t/subtasks-show-on-different-pages/2292>\
**Category:** Bug\
**Created:** [22 April 2024 07:24 UTC](https://community.vikunja.io/t/subtasks-show-on-different-pages/2292 "2024-04-22T07:24:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![3avxxx](https://community.vikunja.io/user_avatar/community.vikunja.io/3avxxx/32/1250_2.png) [@3avxxx](https://community.vikunja.io/u/3avxxx)\
**Post date:** [22 April 2024 07:24 UTC](https://community.vikunja.io/t/subtasks-show-on-different-pages/2292/1 "2024-04-22T07:24:47Z")

</div>

With more than 50 tasks, there’s a split into pages. But when I add subtasks, they show up on the next page, not under the parent, but as single tasks.

---

<div class="post-metadata">

**Author:** ![kolaente](https://community.vikunja.io/user_avatar/community.vikunja.io/kolaente/32/5_2.png) [@kolaente](https://community.vikunja.io/u/kolaente)\
**Post date:** [22 April 2024 15:25 UTC](https://community.vikunja.io/t/subtasks-show-on-different-pages/2292/2 "2024-04-22T15:25:18Z")

</div>

Are the subtasks shown correctly under their parents on the main page? Or are they only shown on the next page?

---

<div class="post-metadata">

**Author:** ![3avxxx](https://community.vikunja.io/user_avatar/community.vikunja.io/3avxxx/32/1250_2.png) [@3avxxx](https://community.vikunja.io/u/3avxxx)\
**Post date:** [22 April 2024 15:52 UTC](https://community.vikunja.io/t/subtasks-show-on-different-pages/2292/3 "2024-04-22T15:52:55Z")

</div>

I created a test project (see attachments) with 14 parent tasks and 5 subtasks each (from 1 to 10). Everything works fine - until the number of tasks in the project reaches 50. From then on, subtasks are not shown under their parent tasks any longer, but on the next page.

As a quick fix, could you give an option in the settings to disable the pagination?

 ![Test-Vikunja](https://community.vikunja.io/uploads/default/original/2X/2/239373fdec7ff8d56cbcc3052cc333e6e3277292.jpeg)

---

<div class="post-metadata">

**Author:** ![kolaente](https://community.vikunja.io/user_avatar/community.vikunja.io/kolaente/32/5_2.png) [@kolaente](https://community.vikunja.io/u/kolaente)\
**Post date:** [23 April 2024 21:40 UTC](https://community.vikunja.io/t/subtasks-show-on-different-pages/2292/4 "2024-04-23T21:40:04Z")

</div>

Disabling pagination is unfortunately not really easy, because it’s baked in deeply into the web handling framework.

I’ll look into a fix.

---

<div class="post-metadata">

**Author:** ![kolaente](https://community.vikunja.io/user_avatar/community.vikunja.io/kolaente/32/5_2.png) [@kolaente](https://community.vikunja.io/u/kolaente)\
**Post date:** [4 June 2024 10:28 UTC](https://community.vikunja.io/t/subtasks-show-on-different-pages/2292/5 "2024-06-04T10:28:11Z")

</div>

This should now be fixed in [#2345 - feat(tasks): expand subtasks - vikunja - Gitea](https://kolaente.dev/vikunja/vikunja/pulls/2345), please check with the next unstable build (should be ready for deployment in ~45min, also on [try](https://try.vikunja.io)).

---

<div class="post-metadata">

**Author:** ![executed](https://community.vikunja.io/user_avatar/community.vikunja.io/executed/32/2775_2.png) [@executed](https://community.vikunja.io/u/executed)\
**Post date:** [7 February 2025 01:48 UTC](https://community.vikunja.io/t/subtasks-show-on-different-pages/2292/6 "2025-02-07T01:48:20Z")

</div>

@kolaente I believe this issue wasn’t fully resolved back in the day.

### **Environment**

- **Setup:** Environment built on the latest `main` branch
- **Also confirmed on:** “try” instance

### **Steps to Reproduce**

1. For better visibility, modify line **57** of `SingleTaskInProject.vue` as follows:  
`{{ task.title + ' ' + task.position }}`

2. Create an **empty project**.

3. Create **45 tasks** in this project.

4. **Drag** the **44th task** to the **last position (45th)**.

5. Observe the **significant position value increase**.

6. Repeat at least **5 times** : drag **44th task to last position (45th)**.

7. Make the **45th task a subtask** of the **5th task**.

8. Add a **few more tasks** as subtasks of the **5th task**.

9. Add more tasks to the project **until the pagination footer appears** , ensuring the next page has ~10 tasks.

### **Expected Result**

- **Page 1** contains **53 tasks** :
  - **50 parent tasks** (including the **5th** )
  - **3 subtasks** of the **5th task**

- **Page 2** contains **some of the initially created tasks** , but **no subtasks**.
- **New tasks push out older tasks** to the next page, but **subtasks of the 5th task remain with it on Page 1** , regardless of their order.

### **Actual Result**

- **Page 1** contains **only 50 tasks** :
  - **48 parent tasks** (including the **5th** )
  - **2 subtasks** of the **5th task**

- **Page 2** contains:
  - The **3rd subtask** with bloated position (which did not stick with the 5th parent task).
  - The task used to **bloat its position value**.
  - Some of the initially created tasks.

### **Developer Details**

A fix was introduced as part of [#2345](https://kolaente.dev/vikunja/vikunja/pulls/2345) to adjust **DB queries** so that:

- The **50 parent tasks** per page would be **combined with their subtasks**.
- This would allow the **List view** to display **more than 50 tasks** in total.

However, an analysis of the **backend GET request** shows that **only 50 tasks** are still being returned. This suggests that:

- Something **above the DB query layer** is still **limiting the result set to 50** tasks, despite the **DB returning more** (haven’t validated, but I assume DB query works as expected).

Kind of obvious observations worth to mention:

- Sorting is done based on **task.position**.
- When a **task with a bloated position value becomes a subtask** , its **position remains unchanged** , regardless of its new hierarchy.

### **Possible Solutions**

1. **Allow more than 50 tasks to pass through** if the **DB query is working as expected**.
2. **Alternative approach:**

- Load **all applicable parent tasks** for the List view.
- For each parent, **fetch its applicable subtasks separately**.
- Improve performance by **first fetching parent IDs** , then loading both **parent task objects and subtask objects in parallel**.
- Not as fast as the current method, but likely **easier to maintain**.

1. **Another potential fix:**

- Make **subtasks inherit the position** of their parent (or adjust with a **minor delta** ).
- However, this could introduce ambiguity if a **subtask has two parents** and **those parents fall on different pages**.

---

<div class="post-metadata">

**Author:** ![kolaente](https://community.vikunja.io/user_avatar/community.vikunja.io/kolaente/32/5_2.png) [@kolaente](https://community.vikunja.io/u/kolaente)\
**Post date:** [8 February 2025 17:24 UTC](https://community.vikunja.io/t/subtasks-show-on-different-pages/2292/7 "2025-02-08T17:24:00Z")

</div>

Thanks for reporting this, I’ll take a look.

---

<div class="post-metadata">

**Author:** ![kolaente](https://community.vikunja.io/user_avatar/community.vikunja.io/kolaente/32/5_2.png) [@kolaente](https://community.vikunja.io/u/kolaente)\
**Post date:** [21 March 2025 17:56 UTC](https://community.vikunja.io/t/subtasks-show-on-different-pages/2292/8 "2025-03-21T17:56:40Z")

</div>

@executed I’m unable to reproduce this with the latest demo. Does this only happen when you change the position of tasks?
