Please check that this issue hasn't been reported before.
Expected Behavior
Expected is that the following query will work when placed inside a canvas card, since it works inside a normal markdown note:
```tasks
filter by function task.file.folder.includes(query.file.folder)
```
Current behaviour
Instead of showing the task contained inside the note in the subfolder, the canvas card containing this query shows the following error message:
Tasks query: Error: Search failed.
The error message was:
"TypeError: Cannot read properties of null (reading 'file')"
Steps to reproduce
From @claremacrae: there is also a shorter reproduction in #2971 (comment)...
Full description of the steps to reproduce:
- Create a new Obsidian vault
- Click the line with the name of your vault, at the bottom next to the gear icon
- Select "Manage vaults"
- Select Create new vault
- Give the vault a name and click Create
- In the new vault, ensure that Canvas plugin is enabled
- Click the gear icon
- Select Core plugins
- Verify that the slider next to Canvas is showing that it's active
- Get the tasks plugin
- Click the gear icon again, if needed
- Select Community plugins from the list
- Click the "Turn on community plugins" button
- Click the "Browse" button
- Find and open "Tasks" by Martin Schenck and Clare Macrae
- Click Install
- Click Enable
- Create a two-level folder structure
- Navigate back to the main window by closing the plugin and settings windows
- Click the new folder icon on the left side of the interface
- Give the folder a name, e.g. "My projects".
- Right-click the folder and select "New folder" to create a subfolder
- Give the subfolder a name, e.g. "Home projects".
- Create a new note with a task in the subfolder
- Right-click the subfolder and click "New note"
- Give the note a name, if desired, e.g. "Project A", by replacing "Untitled" with "Project A".
- In the area below, a task, by entering "- [ ] First task"
- Create a note in the first level folder which shows all tasks in the folder and subfolders below
- Right-click the first level folder ("My projects") and click "New note"
- Give the note a name, if desired, e.g. "Projects list", by replacing "Untitled" with "Project list"
- In the area below the title, enter the following
filter by function task.file.folder.includes(query.file.folder)
The note should now show the task contained inside the note in the subfolder and it does.
- Create a new canvas inside the first level folder with a card which shows all tasks in the folder and subfolders below
- Right-click the first level folder ("My projects") and click "New canvas"
- Right-click an empty area in the canvas and click "Add card"
- Inside the card, enter the same task query as in step 6 above.
I expected this card now to show the task contained inside the note in the subfolder, but it didn't.
Which Operating Systems are you using?
Obsidian Version
1.6.7
Tasks Plugin Version
7.6.1
Checks
Possible solution
I don't know how to fix this but there is a workaround, which is to add the note which already contains the query to the canvas:
- Right-click, an empty area in the canvas and click "Add note from vault"
- Select the note that was created in step 6, above.
This will now show a canvas card with the list of tasks.
Note from @claremacrae: there is a slightly simpler workaround in #2971 (comment)...
This workaround does not adequately achieve what I want. I want to copy the canvas into many different folders, which already exist, and utilize the same tasks query dynamically. If the functionality would work as expected, I would not need to change anything in the copies in the canvas whereas in the workaround I will have to recreate many of the cards for each copy of the canvas.
Please check that this issue hasn't been reported before.
Expected Behavior
Expected is that the following query will work when placed inside a canvas card, since it works inside a normal markdown note:
Current behaviour
Instead of showing the task contained inside the note in the subfolder, the canvas card containing this query shows the following error message:
Steps to reproduce
From @claremacrae: there is also a shorter reproduction in #2971 (comment)...
Full description of the steps to reproduce:
I expected this card now to show the task contained inside the note in the subfolder, but it didn't.
Which Operating Systems are you using?
Obsidian Version
1.6.7
Tasks Plugin Version
7.6.1
Checks
Possible solution
I don't know how to fix this but there is a workaround, which is to add the note which already contains the query to the canvas:
This will now show a canvas card with the list of tasks.
Note from @claremacrae: there is a slightly simpler workaround in #2971 (comment)...
This workaround does not adequately achieve what I want. I want to copy the canvas into many different folders, which already exist, and utilize the same tasks query dynamically. If the functionality would work as expected, I would not need to change anything in the copies in the canvas whereas in the workaround I will have to recreate many of the cards for each copy of the canvas.