0.9.2 Live Templates / Snippets renderQuery is not available in client

Hi there - I use Silverbullet to capture notes in a daily commercial call I attend.

One of the parts of my meeting template is the retrieval of monthly target data. This is stored in a ‘data’ page with the following format:

month: January
revenue: XX.XX
margin: XX.XX
---
month: February
revenue: XX.XX
margin: XX.XX
--
...

I have a snippet that contains the following:

---
tags: template
description: Template that shows the monthly target
hooks.snippet.slashCommand: "target"
---
```template
{{#each {targets2024 select margin, revenue where month = @page.month}}}
{{@page.month}} {{@page.day}}, {{@page.year}} \[Target {{revenue}} // {{margin}}\]
{{/each}}

The @page variables are set within the meta data of my template. This was previously working just fine - I could place {{target}} in a template block and it would always show the correct data.

Since the update, I am presuming to the server side rendering, this now no longer works and I am seeing a JS error in the console when attempting to run this slash command, or embed it within a page.

The error is:

Error rendering template Error: Function renderQuery is not available in client
Error: Function renderQuery is not available in client
    onMessage worker_sandbox.ts:93
    onmessage worker_sandbox.ts:59
    init worker_sandbox.ts:45
    init worker_sandbox.ts:44
    invoke worker_sandbox.ts:107
    invoke plug.ts:108
    collectAllCodeWidgets code_widget.ts:31
    render code_widget.ts:21
    syscall system.ts:134
    syscall plug.ts:46
    onMessage worker_sandbox.ts:72
    onmessage worker_sandbox.ts:59
    init worker_sandbox.ts:45
    init worker_sandbox.ts:44
    invoke worker_sandbox.ts:107
    invoke plug.ts:108
    dispatchEvent event.ts:67
    dispatchEvent event.ts:77
    plugLoaded event.ts:135
    emit event.ts:16
    load system.ts:164
    reloadPlugsFromSpace client_system.ts:204
    reloadPlugsFromSpace client_system.ts:201
    loadPlugs client.ts:858
    init client.ts:233
    async* boot.ts:24
    B2 async.ts:98
    <anonymous> boot.ts:7
    <anonymous> boot.ts:52

Am I using this functionality in now unexpected ways? Is there a better way of doing this - I have looked at using template widgets which does work, but I want the content placed in the body of the page, not at the top or bottom (I distribute these notes to other people).

Ok, this was a bug, but I think I fixed it with Make sure query.renderQuery is run in the right environment · silverbulletmd/silverbullet@d9efb32 · GitHub

You can try it soon on Edge

Nice one - thanks!