Open nioakeim opened 1 year ago
So i found a hint of what is might causing this behaviour. If i have the Automatic View Refreshing on then when the refresh occurs the queries disappear. How could i achieve a refresh of views without this behavior. Is there a function i could implement like await ?
I also face this problem.
I have a similar problem with standalone dv.execute with string (not included from other file). The rendered query disappears and comes back randomly (sometimes after switching edit/view mode, sometimes after reopening the note, sometimes after restarting obsidian). The same query as dataview table in the same note is always working.
I have this issue as well. I have a query as both a dv.execute on the page and a dv.view from a remote file. Both load correctly initially and then dissapear. Re-loading the file does usually bring them back
I'm facing the same problem, also on macOS... I thought i was going insane because this started happening after the Obsidian Tables update late 2023 (afaik). Back then, i suspected some newly introduced Obsidian CSS or one of my plugins to be the issue... But apparently, neither was.
It can't be a CSS issue, since I've checked the Developer Tools' view of the HTML... And whenever the table disappears, the whole HTML element disappears. It just vanishes.
It also cannot be another plugin, since i just made a blank vault with ONLY Dataview installed and tried running a few dv.execute
commands... Nothing changed, compared to my regular vault. The random disappearances were still happening.
However, seeing that Dataview is seemingly no longer maintained (499 issues, damn), while Datacore is being actively worked on, we might just need to sit this one out and hope the new plugin fixes this.
EDIT: It's been three hours, but i randomly stumbled upon this Blog Post on the Obsidian Forum that solved the issue for me. So if you can switch your
dataviewjs
queries fromdv.execute
todv.query
and make some additional changes, i strongly recommend you to try this solution, should the issue still bother you. I had to regex my entire vault, but it seems to have been worth it.
This solved the issue for me:
scripts/some_script.js
:
const result = await dv.query(`
TABLE WITHOUT ID
<rest of query here>
`)
if (result.successful) {
dv.table(result.value.headers, result.value.values)
}
else {
dv.paragraph("~~~~\n" + result.error + "\n~~~~")
}
In the file I want to embed the script:
```dataviewjs
await dv.view("scripts/some_script")
```
What happened?
I am trying to use reusable snippets of DQL queries to embed to my notes, depending on their type, but when i decide to change the DQL i will be able to change the query in one place and not go through all the rest of my notes that use this DQL. Furthermore, this DQL i wanted to be aware of the file that its run within, so that i can use for example this.file.day etc.
So i came across a very nice idea. It goes like this.
Create a file containing the DQL of your choise
e.g.
and in the note to add this snippet of dataviewjs
This worked flawlessly for a few weeks, but if i am not mistaken, after an update, i get a strange behavior.
When i create a new note, the template loads perfectly with my dataviewjs with the correct task list, but after a second they disappear. This happens for any kind of DQL (List or Table) so i am suspecting that either dv.io.load or dv.execute has an issue with this method.
DQL
No response
JS
No response
Dataview Version
0.5.59
Obsidian Version
1.4.14
OS
MacOS