Dataview inline query don't run on note creation from templates and on reloading Obsidian

Hello,

My Templater’s template contains Dataview inline queries that should retrieve frontmatter properties defined by the template. When I create a new note from that template the inline queries are inconsistent, sometime producing the expected result and sometimes showing the default string for queries that “render as null”. I have to pass the cursor through them to actually see query results. How can I consistently view the query results on note creation from template ?

Steps to Reproduce

  • Create a new throwaway vault
  • Install Dataview and Templater plugins
  • Create a new note for the following template
    <%*
    	let noteTitle = "This is a title";
    -%>
    ---
    note-title: <% noteTitle %>
    ---
    # `= this.note-title`
    
  • Use Alt-N to fire the command “Templater: create a new note from template” and select the template created in the previous step.

output

I noticed that when executing the “Dataview: Rebuild current view” command, all inline queries get updated. Is there a way to add an event handler that execute that dataview command when necessary ? (I don’t know when it should actually be done: on tab focus change ? on opening a note ?)

Also, everytime I reload Obsdian with command “Reload app without saving”, inline queries are consistently producing the default string for null results.