fix(js): Remove event listener when resetting tree