SWC-364: only refresh the attachments of the entity when the edit dialog is visible

(we don't care if it's rendered or not).  
also add tests around this functionality