Js state persist on error2

* Rebased on master
* Tests should run on CI now