Changes on XMP Metadata on Layers are not tracked in History

I’ve made a quite elaborate script that proves my hypothesis that XMP data on document level is correctly history tracked - but for Layer-level it is buggy (i.e. History is changed, but changes do not get undone with history). I’ve added it as an attachment rather than inline because of the size.

layerxmpissue.js (5.8 KB)