No Undo after accidently changing the rating of all images?

If I assign a star rating to an image and then realize all images were selected when I did so, then the star rating will be applied to all of the images. When can’t I then Undo my mistake? The Undo menu item is grayed out.

Select all the images again and turn all the start ratings off. Deselect all the images and then reapply the ratings to only the image or images you want. The Undo won’t work because the ratings are not edits.