Error with query in Preview but not in Builder

I would love more insight into errors in Plasmic. I have an app working totally fine on the builder but I get an error when I preview I get an error.

Error: Cannot read properties of undefined (reading 'list')

I figured out that it is an error from a table displaying one of the queries. If I duplicate the page and delete the table the Preview works properly.

I have tried recreating the table from scratch and I still get the error.
Nothing shows up in the issues tab.

Here is the error in the console

react-dom.production.min.js:185 TypeError: Cannot read properties of undefined (reading 'list')
    at eval (render__3RXXP0oNxihg:939:69)
    at eval (render__3RXXP0oNxihg:971:3)
    at PlasmicLeads2__RenderFunc (render__3RXXP0oNxihg:1018:5)
    at func (render__3RXXP0oNxihg:2067:16)
    at lm (react-dom.production.min.js:162:62)
    at oJ (react-dom.production.min.js:218:155)
    at uD (react-dom.production.min.js:258:18)
    at react-dom.production.min.js:257:384
    at uF (react-dom.production.min.js:257:395)
    at u_ (react-dom.production.min.js:250:421)
l2 @ react-dom.production.min.js:185
l.componentDidCatch.t.callback @ react-dom.production.min.js:186
aV @ react-dom.production.min.js:139
oY @ react-dom.production.min.js:239
e @ react-dom.production.min.js:242
(anonymous) @ react-dom.production.min.js:242
uU @ react-dom.production.min.js:243
uE @ react-dom.production.min.js:249
S @ scheduler.production.min.js:12
z @ scheduler.production.min.js:13
Show 10 more frames
Show less
1915.cb42fccf.js:464 Live frame render error TypeError: Cannot read properties of undefined (reading 'list')
    at eval (render__3RXXP0oNxihg:939:69)
    at eval (render__3RXXP0oNxihg:971:3)
    at PlasmicLeads2__RenderFunc (render__3RXXP0oNxihg:1018:5)
    at func (render__3RXXP0oNxihg:2067:16)
    at lm (react-dom.production.min.js:162:62)
    at oJ (react-dom.production.min.js:218:155)
    at uD (react-dom.production.min.js:258:18)
    at react-dom.production.min.js:257:384
    at uF (react-dom.production.min.js:257:395)
    at u_ (react-dom.production.min.js:250:421)

Why does it work in the builder but not in the preview? How can I debug it?
I have been trying to figure this out all weekend. Would love to figure out what is going on.
Thanks team.

Ok I found that when I am using data from another query in the title field then this happens.
I have a table where some of the column names are dynamic depending on the user. Users have different “Attributes” and the table title changes.
The title dynamic value is

$queries.getAttributes.data.response.list.find(entry => entry.aId === "1").attribute_name

This is the cause of the error. Is there any way around this?

$queries.getAttributes.data.response might be undefined if it hasn’t been loaded yet. Use optional chaining to handle the case when it’s still loading. You should also add a fallback option. Here’s an example:

$queries.getAttributes.data.response?.list.find(entry => entry.aId === "1").attribute_name ?? "This is fallback text"