Undefined in expression error for global queries

I’m using the expression editor to get different value drop down lists depending on the value of a property in the currentSourceRow. This is for a CRm and I have both SMS and Email templates and rather than have two dropdowns I thought its nicer to have one on the table. For some reason the global query is not getting recognized in the expression editor for where I map the values of the table drop down. The mapped options section.

{{currentSourceRow.sequenceTasks?.template?.type === 'email' ? getEmailTemplates.data : currentSourceRow.sequenceTasks?.template?.type === 'sms' ? getSmsTemplates.data : null}}

This seems to be an issue a lot when I’m trying to get global queries. A lot of times it tells me undefined but then I actually get the values of the query anyway so it ends up working. I have the global queries set to automatic, so I assume that it runs on app load? I thought this might be a problem in that the variable is not getting loadeed but I can see it in the state editor. Its their but the expression editor doesn’t want to see it.

Trying to call the query in the expression editor

I can see it in the state

Hey @benjaminfortunato - it looks like this might just be a linting error. I will document it internally, regardless, but can you confirm that the dropdown is still being correctly populated?

In general I’m getting the undefined on a lot of my queries, I have the red squiggley lines underneath the query but then as I start to try to access props of that query {{queryinErrorState.data}} i end up being able to access the data. If I was to change the name of the query in the query editor from queryName → queryRenamed I would have to manually go back and rename that query in the expression error. What ever function is dynamically indexing all these queries and lifting them up to a global state where they can be seen by other aspects of the app seems not to be working 100%. I think the intention is that if I rename query 1 to query1Renamed that any references to that query1 are renamed. That seems to work except for this instances where the queries are working in the expression editor but are somehow also in an error state with the squiggly lines underneath it.

1 Like

Ideally, yes! The introduction of multipage apps introduced a ton of new ways for our context engine and linter to break. We are certainly planning to address this, though. :+1: