saveSTate at each click + trim data