Ah nice. I suppose a hacky solution would be to do this on the front end instead, checking for an existing value beforehand so it’s only done once.
Hm, I would’ve thought you’d see some attachments there.
so wp.media.gallery.attachments does not return anything from that function? Based on that comment it seems it should’ve returned the media items.