Best Practice avoiding Undefined errors - Debug Tools

I'm using Insert Queries which being triggered when a NewRow is saved, the NewRow.Data is passed into the query.

At the moment I'll start my app, these NewRow keys are undefined, as there is no NewRow yet. But due of this fact, the DebugTools console is adding error lines (Cannot read properties of undefined) even though the query is not triggered. Not a show stopper as the app is working correctly, but it annoys me as I want to keep the console clear.

Do i have to change these variables to ternary operators or is there an easier/cleaner way to prevent these errors poppin up?

Hey @Ronaldvm!

Optional chaining might help here if you haven't tried it already :slightly_smiling_face: You can try using {{ table.newRow?.name }}, for instance, instead of {{ }}. It'll check to see if newRow is either null or undefined and, if it is, the whole expression will return undefined instead of throwing an error.

Let me know if that works?

1 Like

Thanks, so simple... completely forget / overlooked this option.

keep up the good work!