What's the right way to reference data in a control that is only conditionally available and not trigger property errors?

I have situations where I have dynamic UI that shows up once data is available due to other actions on a page.

E.g. 2 forms -- one to submit some data, then when that's done, a button shows to do something with that data.

In this case, the data isn't available, and I see property errors while editing the app:

What's the right way to reference {{ last_question.data.id }} in this case?

This happens most often for me when you reference table1.newRow, table1.SelectedRow when they are "empty" or a passed value to a query . No harm in this. You only see these alarming red warnings in Edit mode, not in Preview mode.

You will see the property go green once your data is there.

This is true that there isn't much harm in this- the errors won't be shown in the user view of the app

If you'd like though, you can use the optional chaining operator here like {{last_question.data?.id }}

1 Like