Open mrac opened 9 years ago
Thanks @mrac, but timingStack
being an array within a digest cycle is supposed to be an invariant that's assumed throughout the code, so I'd prefer to understand how this could happen before rushing to a fix. Since you can reproduce the exception, could you dig into the sequence of events a bit, perhaps with some console logging? Note that:
timingStack
is declared on line 65, and starts out undefined
.undefined
again.instrumentedPostDigest
function on your stack is monkeypatched in at the same time as instrumentedDigest
, which initializes timingStack
.It almost looks like you're calling digestHudProvider.enable()
while a digest is in progress, so instrumentedDigest
doesn't get to run before the post-digest phase hits, but that's unsupported and ought to be impossible. Could you look into it or share more details about your code please? Thanks.
I got the same undefined error, and it turned out to be because I'm decorating $rootScope.$digest before calling digestHudProvider.enable()
:
$provide.decorator('$rootScope', function ($delegate) {
var _digest = $delegate.$digest;
$delegate.$digest = function () {
// doing some stuff
_digest.apply($delegate, arguments);
};
return $delegate;
});
If I call digestHudProvider.enable()
after decorating I don't get the error...
Interesting. This probably hints at a way towards a fix, but given that there's an easy workaround that's now documented here, perhaps it's best to just leave it be.
This should fix the error I get running digest-hud for my app: