selectedRow.id returns null off hand?

Hello,

I'm experiencing some bug on the retool workflow.

I have this app where it's like an application table where staffs clicks "Approve" or "waitlist" customers then sends and email.

At first hand, there's an error to my workflow that looks like this:

image

As i load the app I got this error:
image
Then after I click on something to re-run the workflow, it works

After I clicked the "Approve" button again and re-run the workflow. It works, any idea why is this happening?

Refer to this vidyard screen share or additional reference:

selectedRow.id returns null off hand?

Cheers,

Hi @Chrismer_Ambay,

So, this is the expected behavior. What this linting error intends to flag is that selectedRow.id (or any other key related to selectedRow) does not exist.

As we know, this will be populated as soon as you select a Row in the table.

To avoid the linting error, you can add a ? after selectedRow, e.g. DropOffTable.selectedRow?.id, this will ensure that the code does not throw an error when selectedRow is undefined or null. The ? (optional chaining operator) safely checks if selectedRow exists before trying to access the id property.

This way, the linting error will be resolved, and the code will only attempt to access id if selectedRow is defined.

2 Likes

That worked like a charm! Thank you!