Detect modal mode and undo

Hello, i would like to know if it would be possible to detect the modal mode and an undo operation ?

It’s for refresh the ui with a calculation especially when it’s necessary. Modal many times, undo at least once. For the moment my panel is refreshed only after a modal (because context.active_operator is a different object) and never after an undo (no solution found except a timer, but when start/stop it ?). :confused:

“when it’s necessary”?

not sure what you exactly wanna do, but it seems you approach doesn’t fit to blender

For reasons of CPU usage (a dimensions panel in edit mode), but it depends of the number of vertices.
Without checking it’s more simple to code but more greedy.
Thank you. :slight_smile: