TLDR
Is there any documentation that deep dives on Dataview trigger events? I am aware of the periodic refresh, but the below issue seems to bypass this functionality entirely.
Longer version…
Basically: when I open a note with a very long code block, the block does not render and the code continues to be displayed until I scroll beyond it (no clicking; just scrolling). This issue only occurs when the block exists directly in a note - I can bypass the problem by rendering the block using dv.view()
.
When the note with the code block is opened, I need to scroll beyond the block for it to render - it just displays the code until I scroll past it. No clicking is needed, just scrolling.
There is no async
or await
activity in the script, and the code is not overly complex - just a bunch of sorting of tasks based on tags.
Below is some pseudocode of the block - I’ve tried to include any functions that are not simply assignments or boilerplate JS:
function embedIncompleteTasks(current_date_str) {
// dv.pages(fp).filter() Get files with incomplete tasks
// files.file.tasks.filter() Get array of parent tags
// tasks.forEach() Loop through all tasks
// --> tags.forEach() Loop through parent tags
// --> task_map.set() Map tasks to parent tag
// task_map.forEach() Loop through all task mapping
// --> dv.el() Header info
// --> dv.taskList() Final task list for respective tag
// [~250 lines]
}
embedIncompleteTasks(current_date_str);
Recreating the scenario
I have attempted to recreate the issue with a simple code example, but I can’t seem to do so. For example:
function myFunc(foo) {
dv.el(foo);
}
// ... Insert a few lines of empty space ...
myFunc("myFunc");
This recreation attempt renders just fine before I even scroll to it, so I’m guessing there is something in my code that is preventing Dataview from triggering.
Just in case, I tried deactivating all community plug-ins (aside from Dataview) and the issue persists.