igvteam / igv.js

Embeddable genomic visualization component based on the Integrative Genomics Viewer
MIT License
640 stars 226 forks source link

ERROR: Cannot read properties of undefined (reading 'table') #1865

Closed nictru closed 1 month ago

nictru commented 1 month ago

Receied this error when loading a bigbed file. Surprises me as I was already able to load some other bigbed files.

Stacktrace says:

TypeError: Cannot read properties of undefined (reading 'table')
    at getDecoder (igv_dist_igv__esm__js.js?v=874868be:20757:112)
    at BWReader.getBedDataDecoder (igv_dist_igv__esm__js.js?v=874868be:21466:19)
    at BWReader.<anonymous> (igv_dist_igv__esm__js.js?v=874868be:21025:44)

When looking at the location in the source code, I assume the problem occurs in this line. Is it possible that autoSql.table is undefined?

jrobinso commented 1 month ago

Well apparently it is possible. Is autoSql itself undefined? I will add a check.

nictru commented 1 month ago

You are right; autoSql has to be undefined for this to occur - thanks in advance for adding the check!

jrobinso commented 1 month ago

Hmm, there's already a check in the line you reference. What version are you using?

    if ("biginteract" === format || (autoSql && ('chromatinInteract' === autoSql.table) || 'interact' === autoSql.table)) {
nictru commented 1 month ago

I used 2.15 when the error first occurred, upgraded to 3.0.1 afterwards.

When looking at the check: (autoSql && ('chromatinInteract' === autoSql.table) || 'interact' === autoSql.table)

Let's say autoSql is undefined, then we get: (FALSE && ('chromatinInteract' === autoSql.table) || 'interact' === autoSql.table)

which leads to (FALSE || 'interact' === autoSql.table)

and then ('interact' === autoSql.table)

So yes there is a check, but the way the brackets are arranged it is not effective. But should be an easy fix:

if ("biginteract" === format || (autoSql && (('chromatinInteract' === autoSql.table) || ('interact' === autoSql.table)))) {

jrobinso commented 1 month ago

Ahh yes, I see now, the parens are out of place, thanks. That is a bug, will fix it.