obsidian-dataview icon indicating copy to clipboard operation
obsidian-dataview copied to clipboard

Error on open with inline dvjs in template

Open aprice opened this issue 1 year ago • 1 comments

What happened?

I have a daily note template that includes a dvjs inline query $= dv.pages('"Daily"').where(p => p.file.day && p.file.day < dv.current().file.day).sort(p => p.file.day, "desc").file.link.limit(1), based on the example query for getting a link to the previous daily note that exists. However, when I create a new daily note, I initially get an error TypeError: Cannot read properties of undefined (reading 'file').

I know sometimes glitches sort themselves out after a moment, after making any change to the file, or switching tabs and back, but this one doesn't; I have to call Dataview: Rebuild current view or close & reopen the file, and then it renders fine. Obviously the type error is a phantom as it resolves itself without any change to the query or the files it's querying.

Note that this is in Editing mode. I recently introduced this to my workflow, so I don't know if the error would have happened in older versions.

DQL

$= dv.pages('"Daily"').where(p => p.file.day && p.file.day < dv.current().file.day).sort(p => p.file.day, "desc").file.link.limit(1)

JS

No response

Dataview Version

0.5.66

Obsidian Version

1.5.12

OS

MacOS

aprice avatar May 21 '24 14:05 aprice

Confirmed the same issue persists in Obsidian 1.6.3 & DV 0.5.66.

aprice avatar Jun 14 '24 13:06 aprice