Preloaded JS doesn't parse embedded expressions (e.g. environment config variables)

Trying to use the environment configuration variables in the preloaded javascript section of an application does not work. These just remain as plain string which is not ideal. I am trying to create a client Object that uses the environment configuration variables to talk to the correct server. At the moment I have these credentials hard coded into the preloaded javascript section.

Hey @dhenl2, we have an internal feature request tracking this, and I'll update you here as I get any additional information on the status. In the interim, you can reference the config vars in a regular JS query, and run that query on page load. Which will make the client Object available to all components / queries etc once the app has loaded.

1 Like

Hi Joe,

Thats a great idea. I'll add this workaround as its more easily reversible then adding bloat to each JS query. Let me know once the feature has been added.

1 Like

It appears this problem also extends to the utility functions available in Retool (e.g. utils.showNotification())