Open vitaly opened 2 years ago
Dataview initializes immediately now before actually loading any page data, so queries run immediately. dv.current()
may return undefined in the first few seconds until the page is actually asynchronously loaded in the background.
I'll need to add an asynchronous wait to the renderers which verifies the current page has been indexed before trying to render anything.
Have you had a chance to take a look at this? I've been using Hover Editor with Dataview, which lets me edit files by hovering over them. The problem is that when I edit the files, Obsidian re-renders the file and loses the scroll position. I turned off Automatic View Refreshing
to prevent this but I came across other problems, such as this one.
Dataview initializes immediately now before actually loading any page data, so queries run immediately.
dv.current()
and any code that uses customJS
don't work if Automatic View Refreshing
is togged off.
Still encountering this problem, my fix is
let attempts = 100;
while (!dv.current() || attempts-- < 0) {
await new Promise((resolve) => {
setTimeout(resolve, 100);
});
}
Tested in empty, clean vault, with just dataview installed.
create a page with the following content:
switch to preview mode
quit obsidian, then start it again
the console will have 2 lines for 'CURRENT', and the first one will be
undefined