-
-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query for all tasks in the query's path, folder, filename etc does not work in canvas cards #2971
Comments
Thank you very much for finding and reporting the problem. Having a list of reproduction steps is also very valuable, and much appreciated. (For future reference, if you ever report another bug in this project, you can save yourself a lot of time by assuming knowledge of basic use of Obsidian, like in this example.) |
I can reproduce the problem, and will write up what I've found. I also note that dataview doesn't recognise the folder containing a query in a canvas file:
|
The relevant code is the obsidian-tasks/src/Renderer/QueryRenderer.ts Lines 41 to 52 in 63ee976
When the Tasks query block is in an ordinary Markdown file, the sourcePath is supplied: When the Tasks query block is in a card inside a Canvas file, the sourcePath is empty: |
I have asked for help on Obsidian Discord. |
I will have to wait and see if the Obsidian team offers a workaround. Currently Obsidian is just not giving plugins the file path of the canvas, so there's nothing I can see to do to fix this.
@psigurdsson You can do that a lot more easily than the Right-click option...
|
A simpler reproduction is:
Actual result: Expected result (when the same query is used in a Markdown file: |
Clare, thanks for the super-quick responses and for the tips, especially on how I can report bugs more efficiently in the future. I'm happy that my bug-report helped develop the tasks plugin, which I'm a great fan of. I'm right now experimenting with creating dashboards for the various aspects of my life, including tasks that I've registered in notes inside folders which represent my areas of focus and that's where this came from. I should be able to use the workaround but there are also other ways to create dashboards than canvas and I might explore those also. |
I've renamed this to make it clear that the problem is specifically querying using the folder that the query is in, rather than any old folder... |
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.
The text was updated successfully, but these errors were encountered: