Hi,
I encountered the same issue today and stumbled across the solution
(for our problem at least, which appeared exactly as above) while
trying to create a nice simple reproduction case.
The issues were:
- In the latest release, a new "statechange" event is being fired
early in setup, and in that initial event, "getState()" always returns
null.
- If an error occurs in the custom "statechange" event handler you
specify, then execution just halts, silently. Chrome refuses to break,
so does firebug - the error just disappears and code stops executing
(if you think this is bad, wait for the next one).
- If an error occurs in the FIRST execution of your custom
"statechange" event handler (or possibly in any handler?), then
"getState()" always returns null for all subsequent calls to that
event handler!
So: our handler code wasn't checking for null and was failing on the
first (new) statechange, and all subsequent calls to getState() were
also returning null because of this first null-handling error.
Now, I've looked at Austin Griffith's example linked above, and the
behaviour is slightly different: on the first call to getState() we
now get a null, as expected I guess - on subsequent calls, however,
the calls getState() errors out and execution of the handler halts
(silently). I can't see any obvious reason why the later getState()
calls are erroring out. Even in my case when we failed to handle null,
it caused getError() to later return null, not to fail.
Sorry I can't help more with this specific scenario, but hopefully
this helps someone else who was getting consistent nulls from
getState() due to an error-handling failure somewhere.
-Tao