explorerhq/sql-explorer

Parameterized query does not work for viewers

broglia opened this issue · 2 comments

Hi,
when I create a parameterized query like:

select count(*)
from products
where published_at > '$$start:2024-01-01$$'

Everything works fine for the user with change permission.

When a user with "view" permission tries to open it, there are following issues:

  • clicking on the refresh link doesn't have any effect. Even if the user changes the value of the parameter, the output isn't updated.
  • the sql box remains open (in previous versions it was collapsed)

If may help, looking in the browser console I can see the following js error:
TypeError: Cannot read properties of null (reading 'addEventListener')
at rC.bind (explorer.5.0.2.js:69:7611)
document.getElementById("show_schema_button").addEventListener("click", this.showSchema.bind(this)),

Thanks so much for the report and the help debugging! This is fixed (along with the styling issue of the Refresh button) here:
#655

I will get it merged shortly, and release 5.1.1