Optimize editing state changing.