Observable’s invalidation promise currently does not resolve when the corresponding cell throws an error:
It only resolves if / when the errored cell is re-evaluated. I would like it to resolve immediately upon rejection as this would make it easier for me to keep track of “live” cells in a notebook I’m working on where some of the cells are communicating with a cell that acts like a “server”.
This is also true of generator cells: the invalidation promise doesn’t resolve greedily after the generator returns; it waits until the cell is re-run.
{
invalidation.then(() => console.log("invalidated"));
for (let i = 0; i < 10; ++i) {
yield i;
}
}
We wouldn’t want to change that behavior because there are many cases where Observable isn’t aware that a cell is still “running” (e.g., in a requestAnimationFrame loop rather than a generator loop), but it’s still useful to handle invalidation when a cell is re-run.
That said, it might still be okay to invalidate greedily on error, since it’s a bit weird to allow the cell to continue to run when it’s showing an error.