beautify: add a cache to avoid redundant resize when press reset button