Cubism-es 1.2.0 actually

In my last post the title mentioned cubism 1.2 but at that time I hadn’t released it.

But as of today it is available on github.

I decided to spend more time adding some testing on the feature that I added (so mainly the zoom part) and once I got it working I wanted to actually get some decent coverage especially for the API that I was using.

It should come as no surpise that adding unit and e2e testing allowed to uncover some bugs that have been fixed in v1.2.0.

I also fixed a bug that seems to materialize at least with Grafana that was causing dashboard to not load properly.

It turns out that cubism heavily relies on setTimeout and callbacks to update the horizon, and if something (ie. unmouting a react component) is removing the divs associated with the cubism rendering (horizon, rules, axis, …) then when the callbacks are executing they are trying to manipulate elements that don’t exists anymore.

The proper fix is to really better track the callbacks so that it’s possible to cancel all of them but until then the solution is to not blindly assume that elements are still here.

If you find it useful don’t hesitate to tell me or buy me some coffee.