-
The Problem
I was trying to disable a query based on if it's been ran and it's results. in one window it says.data
is undefined and in the other it says null. -
How it Happened
I added an input query to a Module and set the test value for it as a query that returns the same type of data. if you try and Run the proxy query for the input it shows an error saying "No query provided for .company_icon_query". This is what sets.data
toundefined
in the proxy query (company_icon_query).
As to how the inspection window saysnull
and notundefined
happened, I have no idea. -
Findings
made a truth table of sorts to show it's null not undefined:
company_logo_query.data === undefined
: false (undefined was added in Ecmascript 5)
typeof company_logo_query.data === "undefined"
: false
typeof company_logo_query.data === typeof undefined
: false
typeof company_logo_query.data === void(0)
: false
typeof company_logo_query.data === "object"
: true
null is of typeobject
, so there wasn't much use in continuing. -
Screenshots:
-
How I Fixed It
I reset the values of everything and it fixed itself and i haven't been able to duplicate what happened -
What Happened? (my best guess)
the inspection and debug windows are capable of displayingundefined
so there isn't a problem there and sincenull
is the actual value, it would point towards the debug window having a bug in the evaluation betweenundefined
andnull
. -
Future Proofing a Solution (maybe)
interestingly, in JS, when using abstract equality both null and undefined end up being checked:
{{ company_logo_query.data == null }}
or
{{ company_logo_query.data == undefined }}
if .data is null or undefined, both of the above will return true