Scoping conflict when using Query Library

I have following setup in multipage retool app:

  • Query in query library which has a variable named "someName" (e.g. SELECT {{ someName }} as result)
  • Page 1 with the query imported (as buttonHandler) and the variable set to a literal text value.
  • Page 2 with input named "someName".

I get this error:

buttonHandler failed (0.008s): Unable to access 'someName' since it is scoped to 'page2'. 'buttonHandler' is scoped to 'page1'.

I would expect it to work without error since variable someName of the query has no relation to the component on the second page.

It occurs in following versions:

  • retool.com v3.304.0-dbe891e (Build 288264)
  • self-hosted Retool version 3.196.25

JSON export of the app:

retool-name-conflict-app.json (10.9 KB)

Screenshot:

1 Like
  1. Go to Page 2.

  2. Select the input component named someName.

  3. Rename it to something page-specific like page2_someNameInput.

  4. Save.

  5. Now {{ someName }} is no longer blocked by the Page 2 component, and the query variable (if named someName) can be used by Page1 queries.

@Anuragsinh Yes, this is what I do to work around the issue, but it is not really practical…

1 Like

Hi @Vojta_Stanek, we have an existing ticket open for this bug but since the workaround is to be mindful of variable names it doesn't have a ton of traction. Either way I have noted your issue internally and can update here in the future if there are changes!