obsidian-tasks: Show Tree Fails to Paint/Show Children Tasks When Fourth Header is Folded

⚠️ Check issue is valid.

⚠️ Check that this issue hasn’t been reported before.

Steps to reproduce

This is hard to describe and I’m not sure I have the issue fully isolated. When using four "Header 1"s each with their own query if the Fourth Header is folded when swapping from Source mode to Reading view, it can cause “show tree” to not show the children tasks for one of the tasks in the First Header’s query.

  1. Create “TaskFile” From The Below Data (or use the Attached File)
- [ ] Task A
	- [ ] Task A 01
- [x] Task B ✅ 2025-03-14
	- [ ] Task B 01
	- [x] Task B 02 ✅ 2025-03-14
- [ ] Task C
	- [ ] Task C 01
	- [x] Task C 02 ✅ 2025-03-14
	- [ ] Task C 03
- [ ] Task D
	- [ ] Task D 01
	- [ ] Task D 02
	- [ ] Task D 03
	- [x] Task D 04 ✅ 2025-03-14
- [ ] Task E
	- [ ] Task E 01
		- [x] Task E 01 A ✅ 2025-03-14
		- [x] Task E 01 B ✅ 2025-03-14
	- [ ] Task E 02
		- [x] Task E 02 A ✅ 2025-03-14
		- [x] Task E 02 B ✅ 2025-03-14
- [ ] Task F
	- [ ] Task F 01
		- [ ] Task F 01 A
		- [x] Task F 01 B ✅ 2025-03-14
	- [ ] Task E 02
		- [ ] Task F 02 A
		- [ ] Task F 02 B
- [ ] Task G
	- [ ] Task G 01
		- [ ] Task G 01 A
		- [ ] Task G 01 B
	- [ ] Task G 02
	- [ ] Task G 03
	- [ ] Task G 04
	- [ ] Task G 05
	- [x] Task G 06 ✅ 2025-03-14
	- [x] Task G 07 ✅ 2025-03-14
	- [x] Task G08 ✅ 2025-03-14
- [ ] Task H
	- [x] Task H 01 ✅ 2025-03-14
	- [x] Task H 02 ✅ 2025-03-14
	- [x] Task H 03 ✅ 2025-03-14
	- [x] Task H 04 ✅ 2025-03-14
  1. Create “QueryFile” From The Below Data (Or Use the Attached File)
# First Header

``` tasks
(filename includes TaskFile)
hide task count
hide backlink
show tree
sort by function task.lineNumber
```

# Second Header

``` tasks
(filename includes TaskFile)
hide task count
hide backlink
show tree
sort by description
```

# Third Header

``` tasks
(filename includes TaskFile)
hide task count
hide backlink
show tree
sort by priority
```

# Fourth Header

``` tasks
(filename includes TaskFile)
hide task count
hide backlink
show tree
```
  1. View the Query File With All Headers Unfolded in Read Mode
  2. Swap to Source Mode then swap back to Reading Mode (Don’t use Split screens)(This Step may not be needed)
  3. Swap to Source Mode
  4. Fold the “Fourth Header”
  5. Swap to Reading Mode

The First Header’s query should have a task that does not show its children. If you click on the task to mark it complete, the children will abruptly show. In my case, First Header’s Task G no longer shows its children (see 4th image below)

QueryFile.md TaskFile.md

Expected Behavior

All tasks in the First Header’s query should show their full tree regardless of the Fourth Headers folded status.

Image Image

Current behaviour

Task G, under the First Header when the Fourth Header if folded, no longer shows Task G’s children tasks (Task G 01, Task G 02, Etc.). This seems to only occur when swapping from Source Mode to View Mode. Also, the bug doesn’t seem to appear when editing and viewing in different windows.

Image Image

Which Operating Systems are you using?

  • Android
  • iPhone/iPad
  • Linux
  • macOS
  • Windows

Obsidian Version

Version 1.8.9 (Installer 1.8.7)

Tasks Plugin Version

7.17.0

Checks

  • I have tried it with all other plugins disabled and the error still occurs

Possible solution

I have no idea how to fix this bug. Isolating it to a repeatable scenario took me several hours.

Tasks is the only plugin I have installed and the problem persisted using the default theme. This bug is subtle, but it caused me to lose faith that my tasks were showing.

Sometimes changing the query order fixed it until I closed/opened Obsidian then swapped between Source Mode back to View mode. Sometimes putting a comment in the First Header’s query between “Show Tree” and “Sort by Function task.lineNumber” fixed it until I restarted Obsidian and swapped between edit/view modes.

Also, editing and viewing the query in split screen didn’t trigger the issue until the split screen was closed (forcing a save of the underlying query file?).

About this issue

Most upvoted comments

I can reproduce it.

SYSTEM INFO:
	Obsidian version: v1.8.9
	Installer version: v1.8.7
	Operating system: Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:22 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6041 24.3.0
	Login status: not logged in
	Language: en
	Insider build toggle: off
	Live preview: on
	Base theme: dark
	Community theme: Minimal v7.7.19
	Snippets enabled: 0
	Restricted mode: off
	Plugins installed: 1
	Plugins enabled: 1
		1: Tasks v7.17.0

RECOMMENDATIONS:
	Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.
	Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.

Many thanks.

I’ve tweaked the original report to use numbered lists and fenced code blocks, so the text can be copied via GitHub’s Copy icon…

I will try to reproduce it, hopefully later today.

Reading mode.

Knowing the prefered terms, I would say the issue happens when swapping from “Source” to “Reading” mode.

I edited the original bug report to reflect the terminology better.