-
-
Notifications
You must be signed in to change notification settings - Fork 449
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
Task path is not updated after note has been renamed #2548
Comments
After a template has been executed, it is considered static text, and you've lost any lookup of any part which was used in the template. In other words, when you insert this template, and it uses Dataview to produce the output, you loose the link to the Dataview query, and all links and other text are just normal text, which will follow the normal rules if you rename or move any files related to that text. So I'm not sure, what you're considering to be the bug here? Is it just a misconception from your part, that the template would be re-evaluated every now and then? |
@holroy, I understand that Templater produces its output once and it remains static. Below I show that renaming the project note before Templater invocation leads to incorrect paths obtained via Dataview. I thought maybe it is a caching issue, but 10 minutes after renaming the bug is still there. Here's the video: Some of my settings: |
I was curious so had a look. I'm finding it hard to tell from the video what exactly the bug is. Is there a simpler workaround with fewer moving parts? Like, assuming it really is a dataview issue, it should be possible to provide a minimal reproduction that demonstrates the problem with just a Dataview script. Otherwise, how can you be sure it's not a Templater issue? |
@claremacrae I'm sorry I didn't bother to make a minimal reproduction in the first place. Here's the one, showing that the issue persists without Templater: const all_tasks = dv.pages('"DataView Bug/Test Projects"').file.tasks;
all_tasks.forEach(task => {
let noteTitle = task.path.split("/").pop().replace(".md", "");
dv.paragraph(`- [ ] ${task.text} [[${task.path}|🗂️ ${noteTitle}]]`);
}); |
Thanks - that's a lot simpler. I think that dataview has some settings to control how often it updates its results. I wonder if that could be affecting the behaviour? |
@claremacrae After three hours, it's still the same. Looking at the source code, I see that |
Good find. This sounds like the sort of thing that might have been reported before then. Maybe earlier reports include workarounds? |
@claremacrae Yes, in the issue I have linked earlier there is a workaround relying on Obsidian's own cache, not the DataView index. |
Thank you. |
Ah, maybe it was only simplifying the reproduction that revealed whether you are encountering the same issue as earlier???? What do you think, is it now the same as the earlier issue? Would the fix for the earlier issue fix this one? |
They're not the same as far as I can see. The other issue is more related to changing the name of the file you're currently viewing, and how dataview handles that. This issue seems to be more an issue related to how the data used in a query had been invalidated by a rename operation without Dataview detecting the rename. This is, and will be an issue, when we rely on the cache to get data from. I've not looked into which cache has been invalidated, and whether this needs to be handled by dataview or obsidian. That is whether there should be some propagation related to the rename event somehow. @claremacrae, do you have (or have had) any similar issue related to queries relying on the |
Great stuff - thanks @holroy. Funnily enough I did something in this area in Tasks recently. This is the one specific commit: obsidian-tasks-group/obsidian-tasks@5fc9fba Here's the latest code, after a bunch of refactoring: Code is MIT - free free to use... |
What happened?
I use dataview objects in Templater code.
This code snippet copies all the tasks with a scheduled date into the daily note, adding a link to a project note where these tasks belong to.
When the project note (containing the task) is renamed,
task.path
still contains original note name.Probably has to do with this issue
DQL
No response
JS
Dataview Version
0.5.67
Obsidian Version
1.8.9
OS
Linux
The text was updated successfully, but these errors were encountered: