Impact of a resonance on thermal targets for invisible dark photon searches