Js state persist on error