Can.batch.stop: Exceptions during execution of queued events

Hello, I work on an SPA using CanJS 2.3 and we’ve been having issues where live binding will periodically stop working.

After some investigation it seems the way can.batch.stop() works means that any exception raised (even ones that are handled) during the execution of a synchronous event in the queue will cause dispatchingBatches = false; not to execute, resulting in the entire queue becoming blocked.

It would seem to me that putting dispatchingBatches = false; in a finally block would resolve this, but browsing through the 3.0 source I cannot see any additional handling for this. Am I missing something? I would expect this to be a fairly common issue in SPAs…

In general, throwing exceptions is not considered a great practice in JS apps. We would need a try catch around some of the most performance sensitive code within CanJS.

If you can demonstrate a good use case, we might be able to expose a way to restore these state-sensitive values. Here’s a related issue: https://github.com/canjs/can-observation/issues/27 cc @phillipskevin

Thanks for the reply, makes sense.