Error thrown by element but said element doesn't exist? (ghosts?)

Hello!
I’m having issues with errors related to non-existant components. Yeah, sounds weird. So I’ll try to explain the best I can :slight_smile:

  1. My goal:
    I have a module that displays a table with information based on its input data. This module (called FileListModule) is itself inside another module (called FileInfoModule). In FileListModule, I have a table element that displays properties about files. The structure is therefore like this:
    FileInfoModule
    └───FileListModule
    └───InfoTable

    Because of some system that I’m using, some of the inputs are never null but are instead given a value that means they are empty (e.g. the input ‘MyInput’ will sometimes get the value ‘MyInputEmpty’ instead of null).

  2. Issue:
    When I have this empty value, FileInfoModule throws an error (it throws it twice as the issue is apprently there twice):

    Error: can’t access property “includes”, currentSourceRow.FilePath is undefined
    from FileInfoModule::FileListModule::InfoTable.events update
    from user interaction

    So I checked inside of FileListModule to see where the issue was coming from. That’s where it gets funny (or not).
    When I go into FileListModule and I use the Code Search (and I search for FilePath), I get three results. One isn’t really related, and the two other results match what I see in the error (InfoTable → Events → Run script → Only run when).
    The catch is that I have no even handlers in that table. I clicked on the results in the Code Search, but it only highlights an empty Event Handlers section (see bellow).

    How can I fix this? How can I remove these ghost handlers to get rid of that error?

  3. Additional info: (Cloud or Self-hosted, Screenshots)
    My Retool is self-hosted on v3.300.7
    image
    That’s about it.

So, there you are. Thank you for taking the time to read this far.
Have a nice day
Cheers :slight_smile:

Hello @418!

It seems like your errors are stemming from a reference to an un-selected InfoTable row. You might need to just add in a optional chaining check on the code like {{ InfoTable.currentSourceRow?.FilePath }} and then the reference will return null instead attempting to access the undefined FilePath property and throwing that error.

Hey @pyrrho
Thanks for the reply.
The thing is, I can’t edit the code as I can’t access it. The code doesn’t appear on my end. Code Search says it’s in the table’s Event Handlers, but there’s no handlers for that table (as visible on the screenshots in my OP).
Please let me know if you have any other idea.
Cheers :smiley:

Since it is a module within a module, is the code you are looking for within the inputs/outputs of either of the modules? The event might not be on the table itself but in a reference to the table somewhere.

Hey pyrrho
No, I even tested with static values.
What makes it so weird is that Code Search highlights the Event Handlers section of this table but it’s empty, as shown on the screenshots.
I have no other events for this table.
Cheers :smiley:

Ok so found a solution.
Exported as JSON
Imported in VSCode
Found the lines (which were only partially filled btw), deleted them.
Reimported the app.
Now working!!

I made a little VSC formatter for Retool’s JSON in order to be able to parse and format the code and read it. It’s called Retool JSON Formatter.
Hope this helps if anyone has the same issue one day.
Thanks you pyrrho for your help!
Cheers :smiley:

1 Like