Sporadic Table-Error: Cannot read properties of undefined (Timing)

Hi,

I have a non-editable table with Row actions like:
image

The data of the table is stored in localStorage by an mysql query global_sqlQuery_localStorageRefresh_keywordPcb.

SELECT * FROM eddy_db.keyword_pcb_view;

If I press the delete row action button a modal frame will pop up and you have to confirm a question. If you confim, a mysql query to set a delete flag in the current row will run.

UPDATE eddy_db.definition_keyword_pcb
SET
  updatedById = {{ global_var_appUser_userId.value }},
  updatedAt = CURRENT_TIMESTAMP,
  deletedById = {{ global_var_appUser_userId.value }},
  deletedAt = CURRENT_TIMESTAMP
WHERE
  id = {{ keywordPage_table_keyword.selectedRow.id }}

If you press the regenerate row action button another mysql query will be run:

UPDATE eddy_db.definition_keyword_pcb
SET
  updatedById = {{ global_var_appUser_userId.value }},
  updatedAt = CURRENT_TIMESTAMP,
  deletedById = null,
  deletedAt = null
WHERE
  id = {{ currentRowId }} ;

(here an additional scope is needed)

If I regenerate or dele, I call the refresh mysql query.

If I click the delete and regenerate button of some rows. In the most time everything is fine. But in some cases I see the following error "Cannot read properties of undefined" :

Could anybody help?

Thanks a lot!

Try using the Debounce field and perhaps add some time like 1000 (1 second) to some of the queries so that they have time to complete before the refresh happens?

2 Likes

Hey @bauergeorg,

Definitely echo what @ScottR says.

Would you mind sharing how did you set up your Delete and Regenerate event handlers?

Also, don't let yourself be deceived by the linting erros. This is a bug in retool where variables that are referring to additional scope will show up in the linting section in the console.

1 Like

Hi @ScottR and @MiguelOrtiz,

I have already played a little bit with the debouce value of 100. Now I checked 1 second at the delete confirm button and the regenerate button and on the refresh function. Nothing could help:

@MiguelOrtiz it is an option that my error is a linter error. I use a couple of times the currentRow of the table.

How can I check this is a linter error? If I reset the log, everything is cleared. Only a onclear number in brackets at linter tab is active. But the content is cleared, too.

If I reproduce this error my error list looks like:

The linter tab looks like:

Thanks a lot to you two guys!

Hey @bauergeorg,

You can try with the optional chaining operator (?.), e.g. keywordPage_table_keyword.currentRow?.id.

If the object accessed using this operator is undefined or null the expression short circuits and evaluates to undefined instead of throwing an error.

2 Likes

Hey @MiguelOrtiz,

I have integrated the "optional chaining operator (?. )" and I can't reproduce the error. Thanks a lot!

Greetings Georg

1 Like