After I added the shape and modified the ID, I found that the undo and redo functions were affected. What should I do?
It is not clear to me how you changed the ID and why. Could you explain your issue in a structured and detailed manner, so anyone has a fair chance to understand your use case?
If you are stuck with a particular problem, provide the necessary context. Phrase your post so that we can follow your line of thought, step by step.