Currently, in the layer store, part of the updateLayersShown function involves adding a frame to the map if it's not added already.
https://github.com/OpenGeoscience/uvdat/blob/947d66ba9ec4f693c55571cf65ba30c8540c5e36/web/src/store/layer.ts#L111-L116
This means that updateLayersShown is responsible for layer reordering, applying layer styles, and adding layers (if they don't exist). Since this code is reached directly after calling addLayer (since that's what modifies selectedLayers and triggers this function to be called), I think it would make sense to simply put this conditional statement there. That would reduce the scope of updateLayersShown, as well as make more organizational sense.